diff --git a/themes/patek/layouts/shortcodes/blogPhoto.html b/themes/patek/layouts/shortcodes/blogPhoto.html
index 823581c..23ba285 100644
--- a/themes/patek/layouts/shortcodes/blogPhoto.html
+++ b/themes/patek/layouts/shortcodes/blogPhoto.html
@@ -20,10 +20,17 @@ or
{{- if (eq $imageName nil) }}{{ errorf "Missing image name in %s" .Position }}{{ end -}}
{{- if (eq $alt nil) }}{{ errorf "Missing alt for image %s in %s" $imageName .Position }}{{ end -}}
-{{- $img := .Page.Resources.GetMatch (printf "%s" $imageName) | default nil -}}
+{{- $img := .Page.Resources.GetMatch $imageName | default nil -}}
{{- if (eq $img nil) }}{{ errorf "Image %s not found in %s" $imageName .Position }}{{ end -}}
-{{- $resizedFullHD := $img.Fit "1920x1080 q50" -}}
-{{- $resizedHD := $img.Fit "1280x720 q50" -}}
-{{- $resizedSD := $img.Fit "640x360 q50" -}}
+{{- $sizes := slice (slice 640 360 50) (slice 1280 720 50) (slice 1920 1080 50) -}}
+{{- $srcset := slice -}}
+{{- $largest := index $sizes 0 -}}
+{{- range $sizes -}}
+ {{- if (or (gt $img.Width (index . 0)) (gt $img.Height (index . 1))) -}}
+ {{- $resized := $img.Fit (printf "%dx%d q%d" (index . 0) (index . 1) (index . 2)) -}}
+ {{- $srcset = $srcset | append (printf "%s %dw" $resized.RelPermalink (index . 0)) -}}
+ {{- $largest = $resized -}}
+ {{- end -}}
+{{- end -}}
-
+