Migrated to Hugo
By Mark Fletcher
- 2 minutes read - 362 wordsI have migrated this blog from Wordress to Hugo. I did so mainly because Wordpress wouldn’t let me do a few things. I wanted to add a rel=me
link so that
Mastodon would associate my @wingedpig@hachyderm.io account with this blog. And, I wanted to be able to customize the blog more than Wordpress would allow
me to do. These are my rough notes on how I did the migration.
First, I exported my Wordpress blog. Then I used the Blogger To Markdown tool to convert the exported Wordpress files to markdown files compatible with Hugo.
I am currently hosting the blog using Linode’s block storage system. I followed the instructions in Deploy a Static Site using Hugo and Object Storage to set that up.
I am using the Ananke theme, but I have customized it. The biggest change was making the home page display full blog posts, instead of summaries. I did that by creating a new layouts/index.html
file, using the themes/ananke/layouts/index.html
file as a template.
Another important change I made was with the RSS file. Hugo defaults to having the RSS file at /index.xml
, but my Wordpress blog’s RSS feed was at /feed
. I didn’t want to lose my existing RSS subscribers. To change the RSS URL, I had to make two changes. In the config.toml
file, I had to add the following:
[mediaTypes]
[mediaTypes.'application/rss']
suffixes = []
[outputFormats]
[outputFormats.RSS]
mediatype = "application/rss"
baseName = "feed"
I also had to copy the internal Hugo RSS template into the file layouts/index.rss
.
The final change I had to make was to set the blog post URL structure to match the old Wordpress blog structure, so that links to old blog posts would not be broken. To do that, I added the following to the config.toml
file:
[permalinks]
posts = '/:year/:month/:day/:title/'
Groups.io is the best tool to get a bunch of people organized and sharing knowledge. Start a free trial group today.