feat(gallery): justified, carousel, and slideshow layouts

Three new design.layout values, all driven by the existing items/resolver
infrastructure (no Hugo-side changes).

- justified: Flickr-style row-balanced layout. Each tile's flex-basis is
  derived from its precomputed aspect ratio at the configured row_height,
  flex-grow proportional to ratio so wider images claim more leftover
  row space. Pure CSS, no JS layout math. New design.row_height field
  (clamped 120-640, default 240). Last item capped at max-width: 50% so
  a lonely last-row image doesn't stretch grotesquely.
- carousel: CSS scroll-snap-type: x mandatory horizontal strip. Touch
  swipe is native; optional Preact prev/next arrows render on md+ only.
  Per-breakpoint flex-basis driven by design.columns (mobile always
  shows ~1 + peeking next). Full-bleed scroll via negative margins
  matched by inner padding so the strip feels native at any width.
- slideshow: Single-image presentation with crossfade transitions, dots,
  arrows, optional autoplay with pause-on-hover, touch swipe, and a
  click-through to the lightbox at full resolution. New design.autoplay
  (default false) and design.autoplay_interval (ms, min 1000, default
  5000) fields. Aspect defaults to "wide" for presentational feel.

Test site adds three new demos pointing at the same album folder so
users can compare layouts side-by-side. Block bundle grows from 39KB
to 66KB; pages without a gallery still ship 0KB (init.html gating).
This commit is contained in:
George Cushen committed 2026-05-18 00:02:17 +01:00
1 parent bdd3820f27
commit f017b3faef
3 files changed
+485 -33

No files matched your search

+43 -1
View File
@@ -122,7 +122,7 @@ sections:
- block: gallery
content:
title: "Recent expeditions"
subtitle: "Auto-loaded from `assets/media/albums/gallery/` — captions stay empty when not provided (Slice 1 behaviour)."
subtitle: "Auto-loaded from `assets/media/albums/gallery/` — sidecar files supply captions for cabin and mountain."
album: "media/albums/gallery"
sort: asc
design:
@@ -133,6 +133,48 @@ sections:
hover_zoom: true
lightbox: true
- block: gallery
content:
title: "Justified — Flickr-style"
subtitle: "Each row is the same height; widths follow the natural image aspect ratio."
album: "media/albums/gallery"
sort: asc
design:
layout: justified
row_height: 220
gap: sm
caption_position: none
lightbox: true
- block: gallery
content:
title: "Carousel — horizontal scroll-snap"
subtitle: "Swipe on touch devices, arrow buttons on desktop. Three across at large widths."
album: "media/albums/gallery"
sort: asc
design:
layout: carousel
columns: 3
gap: md
aspect_ratio: landscape
caption_position: below
hover_zoom: true
lightbox: true
- block: gallery
content:
title: "Slideshow — autoplay"
subtitle: "Hover anywhere over the slide to pause. Click to open the lightbox at full size."
album: "media/albums/gallery"
sort: asc
design:
layout: slideshow
aspect_ratio: wide
caption_position: overlay
autoplay: true
autoplay_interval: 4000
lightbox: true
- block: cta-card
content:
title: "Ready to get started?"