dashboard
repositories
filestore
activity
search
login
scapegoat
/
Docs2
summary
reflog
commits
tree
docs
forks
compare
blame
|
history
|
raw
fix #54: root all image urls
Jacky Zhao
2022-02-16
f192f9a23df34d30e223e20ab5e8cb8210a7dfe9
[scapegoat/Docs2.git]
/
layouts
/
_default
/
_markup
/
render-image.html
1
2
3
4
5
6
7
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 -}}