Migrating From Wordpress to Hugo

I am still editing text files, but it feels so different from ‘95

After many years of running my own site on Wordpress, I finally pulled the trigger and decided to migrate to a different stack.

Wordpress had been working quite well for me until I started to run into some with the hosted version and did not want to deal with having to set up and maintain my own server just for this site.

When I found myself, unexpectedly, with some time to spare – rocking my newborn daughter back to sleep in the middle of the night – I took it as an opportunity to learn what kind of options are available for running simple websites in 2018. I had read so much about static site generators and they seemed such a great fit for what I was trying to do, so I decided to give it a shot.

I am surprised to see how far things have made it since when I last looked. If are interested in the current state of things, you can find a pretty good list on StaticGen.com.

I had no shortage of alternatives to consider but I fairly quickly settled on setting my new site up with Hugo.

Thankfully, the migration itself was not too daunting, I was able to complete most of it during the course of a few nights while holding a sleeping baby 😉

In case you are considering doing the same migration, here an outline of the steps involved and a few articles I would recommend.

  1. Decide whether you want to keep the same apperance or you are okay with selecting a theme you like and just exporting your comment. In my case, I decided to switch to a new theme, so I focused on mapping how my existing content would be organized in the theme I was migrating to.

  2. Migrate your content to Markdown that Hugo can process. I found this article useful: Migrating from Wordpress. Requires installing a plugin on your Wordpress site to export content in a format that Jekyll (another static site generator) can process and then transform that to the format Hugo expects

    If your site is on wordpress.com, the guide above won’t work as is, since you will not be able to install plugins unless you are hosting your own server. I worked my way around this by exporting an XML dump of my site, and then starting up a throwaway wordpress server (I did this with cloud9 when they offered a free plan, you can probably get a similar result by running it on docker).
  3. Your site will likely require some fixes at this point. The specifics depend on what it looks like but it is likely that you will want at least to verify that the links between pages are working fine. Images often require some fixes.

  4. My site had a fair number of incoming links from other places. I wanted to avoid breaking them if possible. This is where I was glad I was deploying my site on Netlify, since they offer great support of Redirect & Rewrite Rules, among many other features.

  5. I had a good number of comments on my old site and I wanted to carry them over. For the sake of simplicity, I chose to use Disqus for my comments and thankfully they had a good article about Importing comments from WordPress.

    Disqus comments are associated with page URLs, so you will want to make sure your pages are served at the same URLs as before the migration. Alternatively, you can edit the URLs in the export file before importing it following the instructions above.

I have yet to find a technical migration that completes without introducing new issues, so if you ever encounter any bugs on this site, I would ask you to please let me know.

Feel free to leave a comment if you are trying to do the same migration and you run into trouble, I can try to help you out.

Avatar
Alessandro Bahgat
Software Engineer & Manager

I am an engineer and manager of engineers, I sometimes play with side projects and write about my experiences in my spare time.

Liked this?

You can sign up here to be notified of new content. Low frequency, no spam.

Related

comments powered by Disqus