Switched to Hugo

Posted by Thoughts and Ramblings on Tuesday, July 12, 2022

You may have noticed that this blog looks a bit different. I’ve decided to ditch wordpress and switch the blog over to Hugo. The primary reason is the maintenance cost for a wordpress installation. This cost comes is two forms:

  1. Keeping wordpress up to date
  2. Moderating comments

Keeping up to date

I know that the first can be mitigated by moving over to wordpress’s hosting but I liked the advantages of my domain hosted on my server. It allowed me to put hidden content at URLs of my choosing which I often did for distributing files to others too large to send via email.

I never liked the idea of letting wordpress being able to update itself so I maintained a git repo on the server where I would extract the archives to wordpress and the plugins I used. I then made a git worktree and branch for each wordpress install on the same server. So I could update the whole install or plugins, commit to the master branch, and then go to each install and rebase on new master. Due to wanting to reduce time of this process, I often created a new worktree to perform the rebase and the reset --hard to the newly rebased branch.

This worked decently well enough and allowed easy backups by cloning the repo locally. However as easy as I made it, I still had to deal with continual updates. If I changed to a static web page, then it eliminates the need to check for updates and apply them.

Moderating Comments

I got many comments that were spam. It was so bad that I have the server firewall off several IP addresses. Even in spite of that and using Akismet to filter comments, numerous ones did get through that I would have to moderate. Given that my blog is fairly low volume, the spam did tend to dominate.

Then many people would be trying to guess passwords by hitting the wp-login.php page. I mitigated the latter by renaming the file and not telling wordpress where to find it. It meant I had to manually change the URL when I needed to login but it stopped the password guessers cold.

Server Performance

The server where this site runs was hit with many orders of magnitude more traffic in the past that it does today. So back then I instigated a two HTTP server setup with nginx running in the front serving up static content and then proxying to apache running dynamic content. The dynamic content used to contain trac and SVN but I have subsequently shut those down and now it is limited to just wordpress. Changing this blog to Hugo and thus static pages further reduces the work given to apache and thus improve the overall performance of the server.


There are many place you can go to find out how to do this conversion and so I’m not going to re-iterate that here. My basic procedure was:

  1. Export from wordpress into a single XML file
  2. Use blog2md to convert the posts to a Markdown document. This did require some modifications:
    1. Preserve the url field so the URLs of my posts won’t change
    2. Correct the date formatting in comments. The script used a d in the date format when it should’ve use a D (day of the week vs day of the month)
    3. Corrected the formatting of block code which was missing newlines around the backticks causing Hugo to not recognize them.
    4. Attempted to sort comments in date order but this didn’t actually work
  3. Cleanup the markdown files to fix conversion errors, order comments, and update formatting to modern design
  4. Pick a theme and I used Clean White at it was similar to my old and configure it.

The above was an iterative process where I used hugo server to preview the content while doing each step. I did each of the above steps as a separate commit in a git repo so if I went back to a previous step I could rebase the work in subsequent steps on the modification. This allowed me to go all the way back to the beginning and redo the whole process without repeating any work. I did just that late in the work as I realized some private posts were not preserved that I would like to keep.


In doing the change, I had to figure out what I would do with comments. Most of my posts never receive a single comment and it is less so in recent days as my most popular projects are no longer in operation (Perian, A52Codec, Fire). So I’ve decided that I’m going to forgo comments on my posts, at least for now. Perhaps I may allow them via the github discussion integration but we’ll see.

I did preserve the old comments and on the pages that had them now contain them as part of the post under the heading Legacy Comments.


That is all. I expect that if this works well, I’ll be shutting down more of the work that apache is currently doing.