Migrating from Wordpress to Hugo

Posted by Johan on Tuesday, April 2, 2019

About a year ago a friend made fun of me when I said I was using Wordpress, apparently Wordpress was not that hot anymore and he started talking about Hugo.

Hugo is a static site generator where you write your posts in markdown and a generator written in Go generates your site as static content. There are some benefits here:

  1. You don’t rely on a database and an internet connection when writing a draft post
  2. You can host the site in an S3 bucket which means you don’t have to have a Linux server.
  3. Having no server means that you can’t be hacked

One drawback is that a static site cannot have search and comments but these can be mitigated by using Algolia and Disqus.

I’m not going to go into too much detail here but these are the steps I performed to migrate:

  1. Export all your Wordpress data to an XML file
  2. Convert your posts using exitwp-for-hugo
  3. Download the pictures from Wordpress, store them in your static directory and change the links.
  4. Go through your posts, there are probably some weird things left behind.
  5. Generate your static site!

That concludes the Hugo part of things, depending on how you plan to host it there are different paths but I’m hosting in Amazon. There are a lot of posts about doing this so I’m not going into details but here’s the high level: 1. Create an S3 bucket (domainname.com is a good name) 2. Set it up for web site hosting 3. Migrate your DNS records to Route53, this is so that you can point the root of the domain to your bucket. Route53 is not free but it’s 50 cents per months so cheaper than a LAMP server. 4. Upload your website to your S3 bucket, just take everything in the public folder 5. Setup CloudFront to host your domain and take care of TLS certificate generation.

Here’s a longer blog post about the steps above: Hosting a HTTPS static website on Amazon S3 w/ CloudFront and Route 53

This is my first Hugo post, I wrote it in Visual Studio Code with the Hugofy plugin.

Cheers

PS I haven’t added search and comments yet so feel free to harass me on Twitter DS