From 8cfe33965bee26cab2190bd6e6fc7706c77945b5 Mon Sep 17 00:00:00 2001 From: stereobooster Date: Sun, 26 Nov 2023 02:02:09 +0100 Subject: [PATCH] use original image as backup for srcset --- layouts/partials/picture.html | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/layouts/partials/picture.html b/layouts/partials/picture.html index 47ffe103..9056f224 100644 --- a/layouts/partials/picture.html +++ b/layouts/partials/picture.html @@ -57,9 +57,17 @@ {{- (.Resize "660x webp").RelPermalink }} 660w {{ if gt .Width 1024 }} ,{{ (.Resize "1024x webp").RelPermalink }} 1024w + {{ else }} + {{ with .Resize (printf "%dx%d webp" .Width .Height) }} + ,{{ .RelPermalink }} {{ .Width }}w + {{ end }} {{ end }} {{ if gt .Width 1320 }} ,{{ (.Resize "1320x webp").RelPermalink }} 2x + {{ else }} + {{ with .Resize (printf "%dx%d webp" .Width .Height) }} + ,{{ .RelPermalink }} {{ .Width }}w + {{ end }} {{ end }}" src="{{ (.Resize "660x webp").RelPermalink }}" {{ end }} @@ -81,9 +89,13 @@ {{- (.Resize "660x").RelPermalink }} 660w {{ if gt .Width 1024 }} ,{{ (.Resize "1024x").RelPermalink }} 1024w + {{ else }} + ,{{ .RelPermalink }} {{ .Width }}w {{ end }} {{ if gt .Width 1320 }} ,{{ (.Resize "1320x").RelPermalink }} 2x + {{ else }} + ,{{ .RelPermalink }} {{ .Width }}w {{ end }}" src="{{ (.Resize "660x").RelPermalink }}" {{ end }}