diff --git a/layouts/posts/single.html b/layouts/posts/single.html index d3567c3..a38bb83 100644 --- a/layouts/posts/single.html +++ b/layouts/posts/single.html @@ -101,26 +101,139 @@
{{- if $bundleImages -}} -
- Gallery - {{ len $bundleImages }} {{ if eq (len $bundleImages) 1 }}work{{ else }}works{{ end }} -
-
- -
- {{- range $bundleImages -}} + {{- /* Pre-compute lightbox items so Alpine gets a static JSON array */ -}} + {{- $lbItems := slice -}} + {{- range $bundleImages -}} {{- $stem := .Name | strings.TrimSuffix ".png" -}} {{- $video := $.Resources.GetMatch (printf "%s.mp4" $stem) -}} -
-
- {{- if $video -}} - - {{- else -}} - {{- partial "img.html" (dict "res" . "widths" (slice 800 1200) "sizes" "(max-width: 640px) 100vw, (max-width: 1024px) 50vw, 33vw" "class" "w-full") -}} - {{- end -}} + {{- $webp := .Resize "1200x webp" -}} + {{- $entry := dict "img" $webp.RelPermalink "video" "" -}} + {{- if $video -}}{{- $entry = dict "img" $webp.RelPermalink "video" $video.RelPermalink -}}{{- end -}} + {{- $lbItems = $lbItems | append $entry -}} + {{- end -}} + +
+ +
+ Gallery + {{ len $bundleImages }} {{ if eq (len $bundleImages) 1 }}work{{ else }}works{{ end }} +
+
+ + +
+ {{- range $i, $img := $bundleImages -}} + {{- $stem := $img.Name | strings.TrimSuffix ".png" -}} + {{- $video := $.Resources.GetMatch (printf "%s.mp4" $stem) -}} +
+
+ {{- if $video -}} + + {{- else -}} + {{- partial "img.html" (dict "res" $img "widths" (slice 800 1200) "sizes" "(max-width: 640px) 100vw, (max-width: 1024px) 50vw, 33vw" "class" "w-full pointer-events-none") -}} + {{- end -}} +
+
+ {{- end -}} +
+ + + +
{{- else -}}