A new blog!
I’ve been growing dissatisfied with my old hosted wordpress blog for a while, for various reasons, and the recent unpleasantness from the Automattic CEO (which I shall not rehash here; you can search the tech news if you want to know more) was a sufficient catalyst for me to start looking for alternatives.
I considered hosting my own Wordpress instance, but hosting and maintaining it would be a huge pain and I was really looking for a low-friction solution. There are a bunch of static blog generators out there, but in true nerd style I decided to roll my own. This wasn’t purely a case of not-invented-here, though, as I had a few very specific requirements:
- Must be as low-friction as possible to write and publish posts, with no distractions.
- No services or infrastructure to maintain beyond the web server I already have. This includes things like git hooks.
- Pure HTML/CSS, no JS, no server-side code, and no external resources.
- Supports light and dark mode themes depending on device preferences.
- Generates modern semantic markup and leverages accessibility features.
- Supports LaTeX equations via MathML.
- Supports generating an RSS or ATOM feed.
- Written in a language that makes it easy for me to modify if I need to.
In the end I found it easiest to just spend a couple of days knocking together some code to do this.
The generator is a C# console app. It orchestrates Pandoc to convert Markdown files to HTML, then performs postprocessing on the HTML using the HtmlAgilityPack library. I did get nerdsniped into implementing media optimisation via ImageSharp, using Butteraugli for perceptual comparisons, but that didn’t really complicate the overall maintenance of the code. One additional neat feature is that I can mark certain images for luma inversion. This causes the image’s luma channel (brightness) to be inverted in either the light or dark theme depending on the setting. This is done entirely with CSS using filters; no changes to the media need to be made.
The writing workflow is simple. I write a post in a Markdown editor (usually Typora in my case). I run the app. It looks for changed content, generates the necessary local HTML files, which I can then view in a browser locally to check it all looks good. Once done I run the publish command and it copies them to my server via SCP. Done.
I probably won’t open source this, because I doubt anyone will actually use it and needing to maintain it for others would violate requirements 1 and 2.
My old blog is now defunct, and you should expect new content to appear here instead. All of my old posts have been converted and can be read here now, but I will keep the old Wordpress blog around to avoid breaking external links. If you were subscribed to the old blog and want to be notified about new posts, you can subscribe to this blog’s ATOM feed or follow me on Mastodon.