Switching from Gatsby to Hugo is not bad. Both use the same style of front matter and Markdown so I didn't have rewrite everything. As they are written in different programming languages, I could work on converting everything while leaving Gatsby alone.
- Backup everything or create a new branch.
- Rename the
Run the following command to generate a new Hugo site in the existing web site folder (it will not work if a
contentfolder already exists).
hugo new site . --force
Add a theme, I used Hermit
git clone https://github.com/Track3/hermit.git themes/hermit
Add the theme to the site config.
echo 'theme = "hermit"' >> config.toml
Start the Hugo server.
hugo server -D
Start moving content.
In Gatsby, all my blog post files were named like the following:
content\blog\postname\index.md. In Hugo, the
postname folder was not needed so I began the slog of moving and renaming my files.
- Create the folder
- Copy a blog post from
content1to the new
index.htmlto the desired slug name for the post.
I had to also move my static content from
src folder to a new top level folder called
As my blog content had a lot of embedded tweets, I had to change all of the references over to a shortcode.
Once I was happy that all my content was moved over and appearing in Hugo, I began deleting all the Gatsby files.
Converting my blog was a bit tedious, but I think it was worth it. I was able to correct spelling mistakes that had been up for years and add tags to the posts.
It only took 8 hours, 20 commits, and 7 builds.