summaryrefslogtreecommitdiffstats
path: root/tpl/tplimpl/embedded/templates/_default/_markup/render-image.html
blob: 8757639100513324157fee98b6b5cae3ccc48472 (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 (.PageInner.Resources.Get $u.Path) (resources.Get $u.Path) -}}
    {{- $src = .RelPermalink -}}
  {{- end -}}
{{- end -}}
{{- $attributes := merge .Attributes (dict "alt" .Text "src" $src "title" (.Title | transform.HTMLEscape)) -}}
<img
  {{- range $k, $v := $attributes -}}
    {{- if $v -}}
      {{- printf " %s=%q" $k $v | safeHTMLAttr -}}
    {{- end -}}
  {{- end -}}>
{{- /**/ -}}