6
0
Fork 0

Gehele figure-tag linken ipv alleen img, anders worden alsnog jpg/png geladen ipv webp

This commit is contained in:
Michael Boelen 2023-05-24 02:47:20 +02:00
parent 5172b4f62f
commit a7092d3990

View file

@ -1,3 +1,4 @@
{{ if .link }}<a href="{{ .link }}">{{ end }}
<figure>
<picture>
{{ $isJPG := eq (path.Ext .image) ".jpg" }}
@ -21,13 +22,13 @@
{{- end }}
{{- end }}
{{ $img := imageConfig (add "/static" (.image | safeURL)) }}
{{ if .link }}<a href="{{ .link }}">{{ end }}
<img src="{{ .image | safeURL }}" alt="{{ .alt }}" loading="lazy" decoding="async" width="{{ $img.Width }}" height="{{ $img.Height }}">
{{ if .link }}</a>{{ end }}
</picture>
{{ if .figcaption }}
<figcaption>
<small><strong>{{ .figcaption }}</strong></small>
</figcaption>
</figure>
{{ end }}
</figure>
{{ if .link }}</a>{{ end }}