From 3ffe2b1002b4c4cae0b3b61ca6c63f263c7762ba Mon Sep 17 00:00:00 2001 From: stereobooster Date: Sun, 26 Nov 2023 01:21:36 +0100 Subject: [PATCH] do not upscale images in picture shortcode --- layouts/partials/picture.html | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/layouts/partials/picture.html b/layouts/partials/picture.html index 4d5aa7e3..47ffe103 100644 --- a/layouts/partials/picture.html +++ b/layouts/partials/picture.html @@ -54,9 +54,13 @@ {{ else }} srcset=" {{- (.Resize "330x webp").RelPermalink }} 330w, - {{- (.Resize "660x webp").RelPermalink }} 660w, - {{- (.Resize "1024x webp").RelPermalink }} 1024w, - {{- (.Resize "1320x webp").RelPermalink }} 2x" + {{- (.Resize "660x webp").RelPermalink }} 660w + {{ if gt .Width 1024 }} + ,{{ (.Resize "1024x webp").RelPermalink }} 1024w + {{ end }} + {{ if gt .Width 1320 }} + ,{{ (.Resize "1320x webp").RelPermalink }} 2x + {{ end }}" src="{{ (.Resize "660x webp").RelPermalink }}" {{ end }} type="image/webp" @@ -74,9 +78,13 @@ {{ else }} srcset=" {{- (.Resize "330x").RelPermalink }} 330w, - {{- (.Resize "660x").RelPermalink }} 660w, - {{- (.Resize "1024x").RelPermalink }} 1024w, - {{- (.Resize "1320x").RelPermalink }} 2x" + {{- (.Resize "660x").RelPermalink }} 660w + {{ if gt .Width 1024 }} + ,{{ (.Resize "1024x").RelPermalink }} 1024w + {{ end }} + {{ if gt .Width 1320 }} + ,{{ (.Resize "1320x").RelPermalink }} 2x + {{ end }}" src="{{ (.Resize "660x").RelPermalink }}" {{ end }} >