summaryrefslogtreecommitdiffstats
path: root/tpl/tplimpl/embedded/templates/_default/_markup/render-image.html
blob: c90ababd2248d6e05e3cec214fe198eb42512653 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{{- $u := urls.Parse .Destination -}}
{{- $src := $u.String -}}
{{- if not $u.IsAbs -}}
  {{- with or (.Page.Resources.Get $u.Path) (resources.Get $u.Path) -}}
    {{- $src = .RelPermalink -}}
  {{- end -}}
{{- end -}}
{{- $attributes := dict "alt" .Text "src" $src "title" .Title -}}
<img
  {{- range $k, $v := $attributes -}}
    {{- if $v -}}
      {{- printf " %s=%q" $k $v | safeHTMLAttr -}}
    {{- end -}}
  {{- end -}}>
{{- /**/ -}}