Gallery: optional caption, with the credit appended; caption the home page photo
All checks were successful
/ build (push) Successful in 1m58s
/ accessibility (push) Successful in 3m55s

This commit is contained in:
Stefan Bethke 2026-11-16 00:11:32 +01:00
commit 3176e02889

View file

@ -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.