Suggestions for managing a photo collection

Over time I’ve accumulated a bunch of images that I use for my blog. I’m trying to think of how to intelligently deal with them in Hugo.

I can imagine that you might be able with some system to reach into a JPG file, pull out metadata, and use that metadata to style the page. Or perhaps you have a directory full of images and a parallel directory with a set of metadata in some file format that is descriptive. I’d love to be able to easily pull all posts with photos from a particular photographer.

Suggestions welcomed! I know about the shortcode “figure” and how it relies on the figure feature in Markdown, but I’ll bet people have been more creative and elaborate than that and I’m looking for inspiration.

I have made a template function that can read a directory of files.
I use it to generate links for a photo gallery.

The commit with the feature is here https://github.com/rustyoz/hugo/commit/2b624140b9982d40c6601af09838504ed9d74bd6

an example of how I use it is here

The variable $images is a slice of type FileInfo.
In theory you could code another template function to read the metadata from jpg files.
A starting points would be this library https://github.com/rwcarlsen/goexif

1 Like