Moving This Blog to Hugo and Netlify
By Ian
For a long time, this blog has been running as a Wordpress app on Webfaction. When I first started using Wordpress, it was long before Wordpress.com provided simple managed services, so using your own LAMP stack hosted server was the preferred approach. A few hosting providers and PHP versions later, it’s probably time to move on.
This set up has served me well, but I’ve never really made use of the more dynamic elements of Wordpress. With the rise of the JAMstack it felt like the right time to switch to a static site generator like Hugo.
There are lots of benefits of this type of approach, including keeping content under source control, having a local writing and site development process, and of course the speed of static HTML content delivered without need of complex server-side actions.
It also gives me the opportunity to deploy the static site on something like Netlify which caters well to simple (and not so simple) static sites delivered from a distributed set of servers instead of a single shared or dedicated server.
Exporting from Wordpress posts to Markdown files is made a bit easier by using one of the many WP to Jekyll/Hugo/Markdown plugins available. It took a bit of fiddly work to replace some of the Wordpress shortcodes I had used with something that Hugo and the Markdown processor could understand.
I shouldn’t have been surprised that the other troublesome part was getting DNS changes to work. Netlify prefers that your personal domain points to their deploy name for a site (http://something-something.netlify.app) so that they can deliver the content from the appropriate place in their CDN. To do this with a base (apex) domain name like ianhuston.net
(rather than www.ianhuston.net
for instance) requires using a new type of DNS record called ‘ALIAS’ and also known as ‘CNAME flattening’.
There’s a longer explanation given by Netlify for why apex domain names are different to subdomains, but the upshot is that I needed to move nameservers for my domain to get access to this feature. This involved the usual tiresome lag while DNS caches were updated. I tried it out first with another domain I own but don’t really use, which gave me the confidence to switch this one.
It took me a while to get around to actually making the changes, after having explored the options, but I’m pretty happy with the results, whether the process updates or the speed improvements.