From 55ad9c2dde7d495fdefc5358b09994a82a342728 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Kr=C3=BCger?= Date: Sun, 10 May 2026 18:40:49 +0200 Subject: [PATCH] feat: banner plays video, opens lightbox with image+video; remove gallery and works counter Co-Authored-By: Claude Sonnet 4.6 --- layouts/posts/single.html | 144 ++++++++------------------------------ 1 file changed, 31 insertions(+), 113 deletions(-) diff --git a/layouts/posts/single.html b/layouts/posts/single.html index 69a4fd0..fd278fa 100644 --- a/layouts/posts/single.html +++ b/layouts/posts/single.html @@ -55,37 +55,46 @@ {{- end -}} - -
- - {{- $imgCount := len (.Resources.Match "[0-9]*.png") -}} - {{- $itemCount := $imgCount -}} - {{- if and (eq $imgCount 0) .Params.items -}}{{- $itemCount = len .Params.items -}}{{- end -}} - {{- if gt $itemCount 0 -}} - {{ $itemCount }} {{ if eq $itemCount 1 }}Work{{ else }}Works{{ end }} - {{- end -}} -
+ +
- + {{- $bannerImg := .Resources.GetMatch "banner.png" -}} {{- if not $bannerImg -}}{{- $bannerImg = .Resources.GetMatch "01.png" -}}{{- end -}} {{- if $bannerImg -}} -
- {{- partial "img.html" (dict "res" $bannerImg "widths" (slice 1200 1800) "sizes" "100vw" "class" "w-full h-full object-cover object-center" "alt" .Title "loading" "eager") -}} -
- {{- else -}} - {{- with .Params.banner -}} -
- {{- partial "media.html" (dict "media" . "class" "w-full h-full object-cover object-center" "lazy" false) -}} -
+ {{- $stem := $bannerImg.Name | strings.TrimSuffix ".png" -}} + {{- $bannerVid := $.Resources.GetMatch (printf "%s.mp4" $stem) -}} + {{- $webp := $bannerImg.Resize "1200x webp" -}} + {{- $lbItems := slice (dict "img" $webp.RelPermalink "video" "") -}} + {{- if $bannerVid -}} + {{- $lbItems = $lbItems | append (dict "img" $webp.RelPermalink "video" $bannerVid.RelPermalink) -}} {{- end -}} - +
+ {{- if $bannerVid -}} + + {{- else -}} + {{- partial "img.html" (dict "res" $bannerImg "widths" (slice 1200 1800) "sizes" "100vw" "class" "w-full h-full object-cover object-center pointer-events-none" "alt" .Title "loading" "eager") -}} + {{- end -}} +
{{- end -}} @@ -134,97 +143,6 @@ {{- end -}} --> - - {{- $bundleImages := .Resources.Match "[0-9]*.png" -}} - {{- $legacyItems := slice -}} - {{- with .Params.items -}}{{- $legacyItems = . -}}{{- end -}} - {{- if or $bundleImages $legacyItems -}} -
-
- {{- if $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) -}} - {{- $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 -}} - -
- Gallery - {{ len $legacyItems }} {{ if eq (len $legacyItems) 1 }}work{{ else }}works{{ end }} -
-
-
- {{- range $i, $item := $legacyItems -}} -
-
- {{- partial "media.html" (dict "media" $item "class" "w-full") -}} -
- {{- with $item.description -}} -
- {{ . }} -
- {{- end -}} -
- {{- end -}} -
- {{- end -}} - -
-
- {{- end -}} - - {{- with .Params.tags -}}