Sam Soffes

Git + Redis Backed Blog

Posted on

I switched back to the old blog I was using before Roon (this blogging platform I used to run). Right before Roon, I had all of these fun ideas for the nerdy blogging platform that I wanted.

The main idea was all of my posts lived in their own repo. This is great for a bunch of reason. Being separate from my blog's source code is nice since it changes every few years. Even when I was blogging on Roon and Ghost, I kept this up to date (with some scripts). I saw a talk from one of the guys that works on Archive.org and was really inspired to start saving as much as I can.

Since my posts are in their own repo, a simple post-commit hook can update my blog. GitHub simply posts to an enpoint on my blog that causes it to reimport my posts into Redis. Another added benefit is people can PR typo fixes. When I click the merge button on GitHub, the webhook fires and automatically updates the post on my site. Neat!

Basically, it's a static site backed by Git & Redis that updates automatically. This is what I built the last few days here and there in my free time last week. The code is on GitHub. I plan to eventually make it more generic so anyone can use it. Also, a lot of the code is 2+ years old so it's pretty gross.

One of my favorite parts is all of the images live in this posts repo. That way, the images aren't tied to any particular host. As part of the importer, it finds all <img> tags, looks for local images in the repo, uploads them to S3, and then updates the tag from a relative link to an absolute link for the newly uploaded image. (It also caches what it knows it uploaded to speed up the process on future runs.)

I'm really enjoying writing posts in my favorite Markdown editor and simply running git push to publish posts!