Hugo/Lightbox image gallery: Loading image captions from EXIF data

1 · Christian Specht · June 29, 2022, 11 p.m.
When I figured out how to create an image gallery with Hugo and Lightbox2, there’s one thing I left out: image captions. In Lightbox2 itself, this is straightforward. Here’s the generated HTML from the current version of my Hugo/Lightbox2 gallery, for one single image (image URLs shortened for brevity): <a href="path/to/image.jpg" data-lightbox="x"><img src="path/to/thumbnail.jpg" /></a> To add a caption, you just add a data-title attribute: <a href="path/to/image.jpg" data-lightbox="x" data-ti...