For some time now I’ve been unhappy with how much more friction there is when posting to my blog[1] than posting to twitter[2]. I keep wanting to blog more but I don’t. Part of the problem is content. I did blog more in 2018, when I was working on projects that had more to share. Part of the problem is expectations. On Twitter it’s expected that I write very little (280 character limit, up to 4 images or 1 animation). That constraint makes it easier to post. On my blog I tend to write longer more involved posts. But part of the problem is the process. My posts on Twitter take a lot less effort than my posts on Blogger. The Blogger UI got a lot worse in 2020[3], but it was already inconvenient for me.
So I’ve been thinking about what I actually want, and what I want isn’t Twitter or Blogger. I want something much closer to Hugo or Jekyll — a static site generator. I want to be able to save a file and have it become a blog post. I want to be able to grep over my existing files. I want to be able to write a perl script to fix something across pages. I decided a goal in 2024 is to switch from Blogspot to a static site generator.
But when I looked at Hugo and Jekyll I started thinking of more things I wanted. In particular, I want to integrate into the rest of my site, which isn’t Markdown, but instead a messy mix of technologies that I’ve worked with over the past nearly 30 years of having a web site. I already have a static site generator. I use Emacs Org-Mode instead of Markdown. Hugo does support Org-Mode[4], and Org-Mode has a way to publish posts[5], and there are Org-Mode blogging packages[6]. But I don’t always use Org-Mode. I sometimes use Markdown. I sometimes use XHTML. And I sometimes use other formats. Also I have my own templating system based on XSLT. So either:
- I use Hugo/Jekyll/etc and replicate my template and other aspects in their format, which means I need to maintain two versions.
- I write my own blog software, which I have to maintain.
But what is actually involved in writing my own blog software? I already have the markup and templating and comments. What’s missing is:
- Atom/RSS feed
- Home page showing the most recent posts
- Browse by category
- Browse by date
Of these, I already want to add browse by category and browse by date to the rest of the site, so the main thing I need to add is an Atom/RSS feed and a home page listing the posts.
Well, I decided to try it.
- Each blog post will be in /blog/YYYY-MM-DD-slug/index.html → no extra work
- I’ll use the templating system I already use for the rest of the site → no extra work
- When I save a file (markdown or org-mode) it will automatically update the html → no extra work
- A short Python script will find all /blog/*/index.html files and generate the feed (xml) and home page (html) → some work
- The home page will use my standard page template → no extra work
- Each blog post will have comments like any other page on my site → no extra work
“How hard could it be?” → famous last words, right? I’ll see how it goes. I’m using python-feedgen[7] and ElementTree[8], and I think it will be around 200 lines of Python code to implement the blog, assuming nothing goes wrong.