You might recall that I tried to make a simple photo sharing site. It worked, but … it wasn’t enough. When you’ve built as many websites as I have, you recognize features almost at a genetic level and the deficiencies stand out. And my simple little site wasn’t going to be enough.
To be fair, I also blame Jeremy. He’s the one who put the idea in my head that I should use Hugo (again; you might recall it from this site), because Hugo has some really great image manipulation abilities.
To be clear, I don’t want to actually manage a Hugo site. As you might recall from my original requirements, I want to manage a bucket of images, and let something else sort it all out.
That didn’t mean I couldn’t use Hugo, I just had to figure a few key things out, notably: how do I tell Hugo that there’s image content to process?
Conveniently, I’d actually already solved a lot of that with my original prototype. Except instead of running the scripts in real-time, the bulk of the code – including the same EXIF library – became a pre-processor. And as much as I dislike Node for its dependency hell, this is one of those times when it’s actually saved me a tonne of grief, because it’s Javascript.
So, I now have to use:
- EXIF Reader, which was previously a real-time request to display EXIF data
- Hugo Data to Pages, which takes a YAML file I build and turns it into JSON-based content files for Hugo to use to build pages
- A couple of required dependencies, such as Prompts, JS-YAML, FS-Extra, TOML, and Yargs
- And a few dozen of their best friend dependencies
Along with a build script that is effectively the repurposed previous version of the site, stripped down and set up to:
- Get a list of files
- Build the album lists
- Get the EXIF for each file (and make a couple of updates to the EXIF data, such as date formatting)
- Write out the album data (in YAML format)
- Call the Hugo Data to Pages script
- Get Hugo to run a build
The best part is, I don’t have to do that to update the images – GitHub does. This is part of the Action I set up for builds, and does all of that in about minute. All I have to do is upload a bunch of (processed and tagged) images to folders, commit them to the Git repo, and fire ’em off into the ether.
It’s not the solution I wanted, but the result – optimized and performant – I can’t argue with. The result is now live at https://photos.sowrey.org/. Expect more photos soon!