From 3176e028895ff663b2bfdc2800ba8af255443073 Mon Sep 17 00:00:00 2001 From: Stefan Bethke Date: Mon, 16 Nov 2026 00:11:32 +0100 Subject: [PATCH] Gallery: optional caption, with the credit appended; caption the home page photo --- README.md | 7 ++++--- content/de/_index.md | 2 +- content/en/_index.md | 2 +- themes/hackertours/assets/css/_gallery.css | 6 +++++- themes/hackertours/assets/js/gallery.js | 11 +++++++---- .../layouts/_shortcodes/gallery-image.html | 17 ++++++++++++----- 6 files changed, 30 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 0fdb6b6..2698cb7 100644 --- a/README.md +++ b/README.md @@ -265,7 +265,7 @@ In the GeoJSON, `coordinates` are already in `[lon, lat]` order, the colour and ## Shortcode: Image gallery -`{{< gallery >}}` shows a page's photos as square thumbnails, two per row on wide screens and one per row on narrow ones. Clicking a thumbnail opens the full image in a lightbox with its alt text and credit; with more than one image, arrows (on screen, the arrow keys, or swiping) move between them, and Escape, the close button or a click beside the image closes it. +`{{< gallery >}}` shows a page's photos as square thumbnails, two per row on wide screens and one per row on narrow ones. Clicking a thumbnail opens the full image in a lightbox with its caption (or alt text) and credit; with more than one image, arrows (on screen, the arrow keys, or swiping) move between them, and Escape, the close button or a click beside the image closes it. ```markdown {{< gallery >}} @@ -277,8 +277,9 @@ In the GeoJSON, `coordinates` are already in `[lon, lat]` order, the colour and | Param | Required | Content | |---|---|---| | `src` | yes | The image: a file in the page's folder, or a path in `themes/hackertours/assets/`. It must be a photo Hugo can resize (JPEG, PNG, WebP…), not SVG. | -| `alt` | yes | What the image shows. It is the thumbnail's alt text and the caption in the lightbox. | -| `credit` | no | Photographer and licence, shown under the thumbnail and in the lightbox. | +| `alt` | yes | What the image shows, for people who can't see it. It names the thumbnail's link, so it can't be empty, and is shown in the lightbox when there is no caption. | +| `caption` | no | Context for everyone, shown under the thumbnail and in the lightbox. Say something the alt text doesn't: screen readers read both, so the same text would be heard twice. | +| `credit` | no | Photographer and licence, appended to the caption under the thumbnail and in the lightbox. | `{{< gallery ratio="original" >}}` keeps each image's own aspect ratio instead of cropping it to a square; a gallery with a single image then spans the full width, as on the home page. Without `ratio` (or with `ratio="square"`), the thumbnails are square. diff --git a/content/de/_index.md b/content/de/_index.md index f3596e3..26cf7b8 100644 --- a/content/de/_index.md +++ b/content/de/_index.md @@ -27,7 +27,7 @@ Hackertours-Desk: DECT 8687 "TOUR", +49 40 573 0830 8687 [C3Nav-Direktlink](https://40c3.c3nav.de/l/hackertours-desk/) Ihr findet uns im Foyer Eingang Mitte, neben den Kassen. {{< gallery ratio="original" >}} -{{< gallery-image src=`hackertours_banner_messe.jpg` alt=`Hackertours am Eingang Mitte der Messe und Congress Hamburg` credit=`CC0 Amzi` >}} +{{< gallery-image src=`hackertours_banner_messe.jpg` alt=`Glasfassade mit dem Schriftzug „Hamburg Messe + Congress, Eingang Mitte“ und dem Hackertours-Haltestellen-Schild` caption=`Hackertours am Eingang Mitte der Messe und Congress Hamburg` credit=`CC0 Amzi` >}} {{< /gallery >}} ## Veranstaltungen diff --git a/content/en/_index.md b/content/en/_index.md index 0a70edb..bfe4a33 100644 --- a/content/en/_index.md +++ b/content/en/_index.md @@ -27,7 +27,7 @@ Hackertours Desk: DECT 8687 "TOUR", +49 40 573 0830 8687 [C3Nav Direct Link](https://40c3.c3nav.de/l/hackertours-desk/) You can find us at ground level of the Central Entrance foyer, next to the cash desk. {{< gallery ratio="original" >}} -{{< gallery-image src=`hackertours_banner_messe.jpg` alt=`Hackertours at Central Entrance of Messe und Congress Hamburg` credit=`CC0 Amzi` >}} +{{< gallery-image src=`hackertours_banner_messe.jpg` alt=`Glass façade with the sign 'Hamburg Messe + Congress, Eingang Mitte' and a yellow HHA bus stop sign` caption=`Hackertours at Central Entrance of Messe und Congress Hamburg` credit=`CC0 Amzi` >}} {{< /gallery >}} ## Events diff --git a/themes/hackertours/assets/css/_gallery.css b/themes/hackertours/assets/css/_gallery.css index 6b61027..0e2d5a2 100644 --- a/themes/hackertours/assets/css/_gallery.css +++ b/themes/hackertours/assets/css/_gallery.css @@ -65,9 +65,13 @@ } } -.gallery__credit { +.gallery__caption { margin-block-start: 0.25rem; font-family: var(--ff-alt); + font-size: var(--fs-s); +} + +.gallery__credit { font-size: var(--fs-xs); color: var(--color-text-meta); } diff --git a/themes/hackertours/assets/js/gallery.js b/themes/hackertours/assets/js/gallery.js index 051962b..7e4af86 100644 --- a/themes/hackertours/assets/js/gallery.js +++ b/themes/hackertours/assets/js/gallery.js @@ -23,7 +23,7 @@