mirror of
https://github.com/alrayyes/wiki.git
synced 2025-06-15 17:53:39 +00:00
fix #54: root all image urls
This commit is contained in:
parent
3b3e6ec3b2
commit
f192f9a23d
3 changed files with 9 additions and 4 deletions
layouts/_default/_markup
8
layouts/_default/_markup/render-image.html
Normal file
8
layouts/_default/_markup/render-image.html
Normal file
|
@ -0,0 +1,8 @@
|
|||
{{$src := .Destination | safeURL }}
|
||||
{{$external := strings.HasPrefix $src "http" }}
|
||||
{{- if $external -}}
|
||||
<img src="{{ $src }}" alt="{{ .Text }}" {{ with .Title }} title="{{ . }}" {{ end }} />
|
||||
{{- else -}}
|
||||
{{$fixedUrl := (cond (hasPrefix $src "/") $src (print "/" $src)) | urlize}}
|
||||
<img src="{{ $fixedUrl }}" alt="{{ .Text }}" {{ with .Title }} title="{{ . }}" {{ end }} />
|
||||
{{- end -}}
|
Loading…
Add table
Add a link
Reference in a new issue