Resize featured images to reduce file size

This commit is contained in:
Joe Hutchinson
2019-07-20 20:12:50 -04:00
parent ad2b26e80b
commit 0a27447f4b

View File

@@ -14,8 +14,9 @@
{{ with $.Resources.GetMatch (replace (.Title) (path.Ext (.Title)) ".webp") -}} {{ with $.Resources.GetMatch (replace (.Title) (path.Ext (.Title)) ".webp") -}}
<source srcset="{{ .Permalink }}" type="image/webp"> <source srcset="{{ .Permalink }}" type="image/webp">
{{- end }} {{- end }}
<source srcset="{{ .Permalink }}"> {{ $featured := .Resize "800x Lanczos" }}
<img src="{{ .Permalink }}" {{ with .Params.description -}} alt="{{ . }}" {{- end }}> <source srcset="{{ $featured.Permalink }}">
<img src="{{ $featured.Permalink }}" {{ with .Params.description -}} alt="{{ . }}" {{- end }}>
</picture> </picture>
{{ end }} {{ end }}
{{ .Content }} {{ .Content }}