Migrating to Pure Blog
It's been five years now since I wrote my first blog post. Crazy how time flies, isn't it? I remember that I was new on Fosstodon and everyone seemed to have a blog so I started developing acute FOMO/peer pressure and figured that maybe I should have one too. The thing is, I didn't know the first thing about web development (that hasn't changed much, to be honest) so I had absolutely no idea where to start.
I asked around and people recommended Hugo to me, a static site generator written in Go. This seemed like a perfect fit because I had a little experience with programming so using an editor or the command line wasn't foreign territory to me, designing a website, on the other hand, was. So I chose a theme from the myriad of possibilities there is, configured a little YAML here and there, plugged a few ugly snippets HTML in some places to customize footers etc. and started writing blog posts (blosts, I mean). Markdown is easy to learn and it seems to be what everyone uses these days.
I started using the free offering at Netlify which included webhooks that detect when you push to your Git repository and CI building and deploying your website automatically so you don't have to take care of any of this. For quite some time that was fine. But as time went on I aquired more knowledge and skills and within me awoke the insatiable urge to tinker and to take more control over my own data. I switched hosting providers, I switched git forges, I tinkered with setup, finally I decided to host the website myself since I had a VPS lying around anyway but I always stayed with Hugo. Until now.
Hugo is still cool and I definitely could've just continued using it but the simple truth is that I like new and shiny stuff. There were also a few nitpicks I had with my setup here and there which is probably mostly due to the theme I was using, not to Hugo itself. I didn't feel like devising my own theme, though, I really suck at design and HTML/CSS are also not my strongest suits.
In seemingly totally unrelated news, I've been following Kev for a long time now, he used to be one of the Fosstodon admins and I liked following along his exploits and shenanigans, many of which were related to redesigning and overhauling his website (yet again). He covered a lot of ground over the years and explored various platforms until, recently, he created his own: Pure Blog. And for some reason, I was very intrigued. According to Kev it was the perfect balance between ease of use and customizability (for him) and I'm sure most people are aware how incredibly difficult it is to strike a proper balance between these. So I took a look and went straight into the rabbit hole and over the last two(ish) days I migrated my website to Pure Blog. I decided to host it myself, struggled a little with the website because, frustratingly (and surprisingly), the documentation for getting set up with a self-hosted environment is somewhat lackluster but I managed. I ended up sticking the whole thing in a container with an instance pf Apache inside to wall everything off from my main system (don't @ me, seriously, if you wanna hate on Docker, go somewhere else). Some of the niceties I now enjoy are:
- Really slick looks
- Admin web UI
- Dashboard with writing statistics
- Easy theming via UI
- Automatic uploading and insertion of images
By design Pure Blog is fairly barebones (which is a good thing, I think) and, by extension, pretty hackable while still being reasonably simple to parse and understand. One caveat is that it's written in PHP which I don't know the first thing about and I don't really intend to change this much. There were a couple of hurdles I came across and that I had to take but I was able to either set up or implement everything I needed. Here is a mostly exhaustive list:
- Catppuccin theming (light and dark, responsive)
- Add "Reply by Email" button to post-meta (this is done via layout partial, similar to Hugo)
- Customize footer (also with partial)
- Bake in analytics (Umami, needs a little JS snippet in footer, simple copy-paste from admin UI)
- Add button to scroll back to the top of the page
- Markdown postprocessing
- Syntax highlighting (bit weird that this is not supported out of the box)
- Render code block in
detailsblock - Include code snippets from external files via shortcode
- "Copy to clipboard" button for code blocks (sorry, but it's incredibly silly that this is included by default)
- Render formulae
- Automatically generate TOC via shortcode (this should also be supported by default, I think, it seems like a reasonably common use case)
- Redirects for old paths
Especially the Markdown postprocessing was a chunk of work but at the same time it includes the most important things I need. You see, there is one blost (not saying which) that receives much more traffic than anything else on this site (more than 50 % of the total, I think) and it alone needs almost all of the things in the list above. This is the single most important thing I have on this website so I needed to make sure the quality of that blost doesn't deteriorate. I encountered various weirdnesses with rendering Markdown inside HTML tags, what uBlock Origin blocks (and what it doesn't), PHP funniness and whatnot. But Pure Blog does expose hooks that run on certain events, one of them being on_render_markdown that you can hook into (get it?). I now have a ~300 SLOC PHP file that takes the prerendered HTML and processes everything so it lives up to my expectations. I must admit, I didn't do it all by myself, I did lean on LLMs to help me along. Like I said, I know almost nothing about PHP and it was incredibly slow going without the help. Not sure how I feel about this but I'm decidedly happy with the result.
So there! Would I recommend you also make the jump? Not necessarily, especially if you do more than just write simple text and include the occasional image. On the other hand it really is an appealing package and I think the balance between extensibility and simplicity is pretty good. Of course I don't know if or how long I'll stick with this but for the moment I'm happy!