Migrating from WordPress to Hugo: 5 years, 9 months later

I’m already coming up on my sixth anniversary with Hugo. Wow, time really does fly. I feel like sharing some of my experiences with Hugo and how it compares to my previous long run with WordPress.

The way of the Hugo

Hugo is a fast-moving target and it does not care much for backward compatibility. You get a few deprecation warnings and then stuff just blows up :) On the flip side, you do get a constant stream of new features to play with. However, for a simple blog like mine, Hugo was feature-complete for my needs many years ago.

goHugo: Execute of template failed

None of this was an issue before the maintainer of the Hugo theme I’m currently using stopped pushing updates to keep the theme compatible with current Hugo releases. I hope the theme author is doing well, and I’m not saying the author owes me anything. The Binario theme is offered as open source and anyone is free to fork or contribute.

Great in theory, but in practice, you’re left with the pieces when someone decides they don’t want to offer their time for free anymore. Unsurprisingly, it’s not the most sustainable business model in the world.

Code poking

I’ve managed to keep the theme working with minimal effort by doing some Google-fu and adding small fixes. However, with the release of Hugo v0.146.5, this came to a halt when I tried to load an old post and got the following result:

goHugo post rendering error

It does look like a templating error since the post is not rendered correctly. However, it does not trigger any error messages. Since the issue was only affecting old posts, I suspected it could be related to some of the extra front matter that got added during the migration from WordPress way back when.

The layout: post front matter as shown below was my prime suspect as the Binario theme doesn’t have a matching template:

id: 1336
title: How to install the Asus USB-N13 Wireless Adapter...
date: 2013-07-22T22:13:10+02:00
author: Roger Comply
excerpt: A while back I bought the USB-N13 wireless...
layout: post
guid: http://www.blog.paranoidpenguin.net/?p=1336
permalink: /2013/07/how-to-install-the-asus-usb-n13-wireless/
categories:
  - GNU/Linux
  - Slackware Linux
tags:
  - Asus USB-N13
  - Slackware

However, this didn’t use to be a problem and I have no idea what changed with Hugo to trigger it after all this time.

Say what you will about WordPress, but I recently restored a WordPress-based website that had been offline for ten years and I could simply update it to the latest WordPress release without any issues.

We can work it out

With a bit of forward-thinking I could have pinned an older version of Hugo and stuck with it “forever”, but hey, why make it easy on myself. Hugo is nerdy, and I don’t need an excuse to spend some time learning Hugo’s templating syntax and other features. After updating the theme and removing the obsolete front matter, I even discovered that a few of the features I have implemented “on the side” were now available in Hugo core.

Hugo v0.146.6

Since I started writing this post a couple of weeks ago, there have been several new Hugo releases. My issue seems to have been fixed as well:

Hugo v0.146.6 What’s Changed tpl: Fix when layout specified in front matter and no match is found 088cd2f @bep #13628

A return to WordPress?

Not in this lifetime, thank you. All software has flaws, but Hugo is still pretty darn great. Even though WordPress is impressive with regard to backward compatibility and features, there are serious performance issues to be expected when maintaining a codebase with that much legacy support.

Static site generators are great, but they are not great for everyone. Count me in the “Move fast and break things” camp :)