This site used to be powered by [Jekyll]. I found myself writing a lot of plugins to add things like dynamic archives and alternate content formats (i.e. ActivityPub), and eventually realized it would be fun to once again rolly my own CMS. That decision doesn’t really factor in to how I publish photos—this would work for any flat-file static site generator.
Photos I take with my phone are automatically synced to Dropbox, and my Dropbox files are automatically synced to my computer. This gives me a known location for anything new I might want to publish.
I wrote a script that looks for new files in this directory since the last time it was run. For each photo it finds, it creates a copy at a web-friendly resolution with all EXIF data stripped out and dumps it among my site content. It also creates a companion YAML file that includes the relevant metadata from what was removed—namely, the GPS and date taken, along with the name of the resized file (and the original filename, just in case).
I manually delete the created files for any photos I don’t want to share, and manually move all the photos to the web via FTP. (I could just store these alongside the site, but it makes more sense to me for them to live in my untracked “assets” directory.)
Yet another script generates a JSON file that compiles all the static photo metadata files into one big blob.
A static HTML page reads that JSON blob and renders a little UI for me to enhance the metadata. This includes choosing named locations when relevant, omitting GPS data when the photo was taken somewhere private, and adding captions and alt text.
This HTML page isn’t incorporated into my build system—instead, it keeps track of all the changes I’ve made in the UI and provides another blob of JSON that’s just the changed data
One last script accepts the JSON diff and applies it to the static files
Finally, I can push the updated files to GitHub, then pull from my web server. I don’t check the built files into version control; instead, I pull the source files and re-build. This is an artifact from when I was using Jekyll, but maybe I should simplify this some more.
That’s it! So simple! It literally couldn’t be any easier!
One limitation of this system is that it all runs on my computer, which means there’s inherently a lag between taking a photo and publishing it, and generally I publish new photos in batches. I like this limitation. It feels like getting a roll of photos developed, and anybody subscribed to my RSS feed will see a whole day’s or week’s worth of photos all together.
I think an improvement I still want to make is automating the FTP upload and making the editing process a little more streamlined, but for now this is more than easy enough. I’m not going to share the code because I don’t think it makes sense for anyone but me to use, but if you have questions about how to get something similar working for yourself I would love to try to answer them. Get in touch!