I have been toying with the idea of migrating this blog to a static site to simplify its maintenance for some time. While WordPress is a great tool, this blog is a side project and any time I have to spend maintaining WordPress gets deducted from the time I have to write for the blog. Keep in mind that I'm self-hosting this blog and it's actually running on a Linux VM that only handles the blog. This is yet another server that I need to administer, and it's the odd one out, too, as all of the others are FreeBSD or OpenBSD servers.
Oh, and one of the big advantages of using a static site generator is that the whole site can be put in version control, archived there and also quickly re-generated from there should I manage to spectacularly mess up the host. A WordPress restore is a fair amount more work, as I found out about two years ago.
The only parts that don't back up that well are the comments, especially if I use a self-hosted system for them.
Migration is fine, but what to?
For that reason, I had experimented with moving the blog to Jekyll for quite a while. In fact, I have maintained a parallel Jekyll blog for years now. The devil for a smooth switchover was in the details though, and I was never happy enough to actually migrate and shutdown the WordPress site.
After another patchapalooza, I revisited the idea of converting the blog to a static site and looked at several other static site generators. I also decided to resurrect an experiment I had started with Hugo. My first attempt hadn't been very successful, so I stuck with Jekyll. This second attempt however is a lot more successful as it addressed a couple of the issues that kept me from being happy with Jekyll:
- Hugo builds the site much faster than Jekyll
- I found a theme that I'm really happy with. You're looking at it right now.
- It looks like some of the details that I found hard to get right in Jekyll are already handled nicely in Hugo. This is mostly around the RSS feed generation - Hugo by default generates category feeds in addition to the regular "full" feed. It also looks like the category feeds are very similar path-wise to what WordPress uses, so hopefully the RSS feeds should continue working with the couple of aggregators that picked up this blog.
Fortunately, this time I succeeded in importing the site from Jekyll into Hugo. It took some work to clean up some of the artifacts that originated in the WP-to-Jekyll conversion, and then I had to convert the Liquid template code to Hugo shortcodes. The latter was pretty easy, but a bit tedious. Just not tedious enough to write a script to do it.
Hugo can render org-mode files (and so can Jekyll, apparently)
Another nice feature is that my workflow can still use org-mode for when I want to use it to write longer posts. Shorter posts I usually crank out in Markdown, but for the more complex posts it's nice to have org-mode as an option. Especially if the post contains source code.
While the setup I described before with using org-mode to post to WordPress is mostly working, it's a bit clunky especially if you're using more than one computer to work on blog posts. Both Jekyll and Hugo can handle org-mode files directly - in fact, even though this file would be as effortless to write as Markdown, what you are currently reading is actually a processed org-mode file.
What's left to before the actual cutover?
There are two fairly large items I have to tick off the todo list before I can cut over for good.
- Migrate the comments. Now this blog doesn't get a ton of comments, but I appreciate all of them and am trying to migrate them over to this blog. As I believe in self-hosting everything, I'm experimenting with isso, and I need to redo some of the experiments with Hugo as so far, they've been completely focussed on Jekyll. Hugo does have built in support for disqus, plus this theme has support for staticman, but neither of the two are my preferred alternatives.
- QA the site, especially the RSS feeds so that they hopefully keep working as they do right now.
- There are still some minor tweaks to be done, analytics integrated and all that, but those are probably going to happen slowly after the cutover.
- Oh, and the last item is all of the draft posts that have accumulated on WordPress that I somehow never got around to finishing.
The beta of the static site is here if you want to have a look. Any feedback is welcome.