Performance; convert images to webp!

This commit is contained in:
Sivert V. Sæther 2022-08-18 03:08:50 +00:00
parent 7d2222a3bc
commit a32e0736c4

View File

@ -1,5 +1,6 @@
{{ $img := resources.Get (.Get "src") }}
<figure {{ with .Get "class" }}class='{{.}}'{{ end }}> <figure {{ with .Get "class" }}class='{{.}}'{{ end }}>
{{ with resources.Get (.Get "src") | fingerprint }} {{ with $img.Resize (printf "%dx webp q69" $img.Width) | fingerprint }}
<a href='{{ with $.Get "link" }}{{ . }}{{ else }}{{ .RelPermalink }}{{ end }}' target='_blank'> <a href='{{ with $.Get "link" }}{{ . }}{{ else }}{{ .RelPermalink }}{{ end }}' target='_blank'>
<img src='{{ .RelPermalink }}' integrity='{{ .Data.Integrity }}' <img src='{{ .RelPermalink }}' integrity='{{ .Data.Integrity }}'
{{ if or ($.Get "alt") ($.Get "caption") }}alt='{{ with $.Get "alt" }}{{ . }} {{ if or ($.Get "alt") ($.Get "caption") }}alt='{{ with $.Get "alt" }}{{ . }}