PaperModX/layouts/_default/_markup/render-image.html

12 lines
426 B
HTML
Raw Normal View History

2022-05-20 11:19:35 +01:00
{{- $img := .Page.Resources.GetMatch .Destination -}}
{{- if and (not $img) .Page.File -}}
{{ $path := path.Join .Page.File.Dir .Destination }}
{{- $img = resources.Get $path -}}
{{- end -}}
2022-05-20 16:04:58 +01:00
{{- if $img -}}
2022-05-20 11:19:35 +01:00
<img loading="lazy" src="{{ $img.RelPermalink }}" alt="{{ $.Text }}" {{ with $.Title}} title="{{ . }}" {{ end }} />
2022-05-20 16:04:58 +01:00
{{- else -}}
{{- warnf "No image found for %s from %s" .Destination .Page.File }}
2022-05-20 11:19:35 +01:00
{{- end -}}