Converting this blog from Wordpress to Hugo

· by Steve · Read in about 3 min · (584 Words)

I’ve been running this blog through a CMS since around 2003. The first version of this site that went beyond manually edited HTML ran on on PostNuke, for reasons I can no longer remember. 🤔 I moved to Wordpress around late 2005, and I’ve basically been running it ever since.

It’s served me well, but as you can tell I don’t blog as often as I used to, and it got to the stage that my most frequent use of Wordpress was updating it, rather than adding content. I don’t trust auto-updaters and the inherently lax permissions you have to give the web server to enable them, and this was getting tiresome. So, I’ve been considering moving to a static site builder for a while.

I’ve finally done that today, by moving to Hugo. It was relatively painless; based on advice I converted to Jekyll first then used the native command hugo import jekyll, since that path seems the most tried and tested - important when you have 13 years of content like I do. It generally went fine, I just had to patch up a few things:

  • Replace Wordpress-specific emoticon references with Emoji. For some reason the converter converted some automatically, but not most. Hugo 0.16 is supposed to support :smile: style Emoji with enableEmoji=true, but that didn’t work for me. Just pasting the Emoji stright in as UTF-8 works fine though, and is actually easier in practice (no need to look up codes)
  • Convert images to custom shortcode figure shortcode. I only did this for the latest few posts but it cleans them up quite a bit. I also customised my theme a bit since I like using right-floating images with captions.
  • Fixed up embedded unicode references; things like quotes had been converted directly to unicode embeds and although it looked OK in many places, in others it got escaped and is just generally ugly. Since Hugo has options to use curly quotes etc it was better to standardise and let the formatters handle it.
  • Replace embedded <pre> tags with proper code blocks. Again I only did this for the most recent posts but it cleans things up and lets the syntax highlighter work correctly.
  • Hook up Disqus ID - luckily I’d migrated comments to Disqus a while ago and the converter pulled in all the IDs and kept everything working.

Why Hugo and not Jekyll?

Fairly simple really - I prefer Go as a language to Ruby, so I naturally gravitated toward it - if I need to peruse or even patch the code I’m going to be much more able to do that with Hugo.

On top of that, Go is more efficient than Ruby, so since I have a fair amount of content it makes sense to go with the faster option.

Conclusion

Hugo seems to work very well, and now I don’t have to worry about updating Wordpress any more, or about any other server code since there isn’t any. All the old links work AFAICT; the only thing I’ve really lost is Search, which I may add back later via an external site search option, or I may not; it’s not difficult to search using Google after all.

What I really want to do next is set it up to auto-deploy on push, but I’m out of time today; one for a future weekend 😀

Wordpress is great, but I just don’t need it any more. If you don’t either, I’d recommend taking a look at Hugo.