I knew when I was setting up a new site that I wanted to use some type of static HTML generator. I’ve always been partial to Jekyll so I found a theme I liked and deployed it up on S3/Cloudfront.

However, I found myself quickly yearning for ways to share content without always having to build and deploy from my local machine. Ideally I’d be able to post content right from my phone while I was away, like how we normally would with social media, but I wanted my content on my personal site.

So to scratch this itch, I wrote Publisher; a simple little Python script that watches a directory and publishes new files to S3. I have it running on a home server with a private installation of Nextcloud. It’s configured to watch a particular directory within the Nextcloud data directory for my user. When I want to publish a new photo I can use my phone or laptop to drop the file into the target folder and when it syncs to the Nextcloud server the script catches the event and publishes the photo. When I make updates to the script by pushing commits to the master branch the changes propagate to the machine within 30 minutes ala chef-client.

To integrate the dynamic content into the site I just use some simple Javascript to fetch a JSON structured file from S3, latest.json, containing the path to the most recent upload, and then I can serve the image in the page. You can see the current image feed here: current photo feed