Back in 2018, I silently upgraded this site to “Tombuntu 3.” To reduce hosting costs and maintenance, I migrated from WordPress to Hugo, a static site generator. Here’s a (belated) overview of the process.
I had almost five hundred old posts that needed to be migrated from an exported WordPress XML file to Markdown files. There are off-the-shelf solutions for this, but I knew there would be complications. I ended up doing the migration myself, with a Python script.
WordPress’s XML file contains HTML, but lacking paragraph tags. I used this implementation of WordPress’s autop function to add them in.
I wrote my old posts in WordPress’ visual editor. It produced HTML that looked fine at the time, but wasn’t semantic. For example, I often created headings with a bold single-line paragraph. To fix these issues, I came up with simple heuristics to find them, and implemented regular expression substitutions to fix the HTML.
Finally, I used Pandoc, a document converter tool, to convert the HTML into Markdown files suitable for Hugo. These files also include important metadata such as each post’s original URL and RSS GUID from WordPress.
Tombuntu no longer accepts comments. I preserved historical comments by appending them to the content of each post in a special “archived comments” section. Feel free to send me your comments via email using the button at the end of each post.
I work on Tombuntu from a Git repository on my workstation. To deploy the site to its web server, I wrote an Ansible playbook that uses the synchronize module to efficiently upload changes. I also use Ansible to configure the server.
Tombuntu 3 runs with room to space on a cheap virtual server and has been easy to maintain so far. Hugo works well, although I had to work around a bug in its “shortcodes” feature. This month I also upgraded the server to Ubuntu 20.04 and added HTTPS support using a free Let’s Encrypt certificate.
I’m still using Ubuntu at home and work every day. Maybe I’ll find something to write about other than this site itself sometime!