Migrating From WordPress to Hugo
I decided to clean up my website and move to a static site for a few reasons:
- Start using MarkDown more frequently, as I’ve grown to really like it for documentation.
- Cut down on costs of hosting the WordPress site.
- Simplify the overall design.
In the migration process, I had to do a few things to get the site fully migrated over.
Deploying to Github Pages using Github Actions
First, I created the Hugo site by following the Quick Start Guide at Hugo, picking a theme, then committing the changes to my Github in a repo named .github.io. I also added a .gitignore file that wasn’t included.
After that, I created a Github Action workflow using this Github Action, deployed the site using the workflow, then enabled Github Pages in the repo settings (selecting the gh-pages branch generated from the CI/CD process). At this point, you can verify the site is up using the repo name above as the URL.
Finally, I set up DNS records for my apex domain (dfar.io without a www) using this guide and set up the domain in the repo settings.
Copying Data from WordPress to Hugo
To migrate my content, I installed the WordPress to Hugo Exporter, exported out the data, and added it to my content/
folder. I had to go through and fix a decent amount of the posts, but overall was pretty quick to get years of blog posts converted over.