blog migration from wordpress to hugo

Introduction

Hopefully, this page is helpful for those of you who want to migrate your blog from Wordpress to Hugo. If so, you’ve come to the right article, because this Sekode blog is also made static using Hugo. Tutorial for Creating a Hugo Blog for the tutorial, click the link next to it.

Why Migrate from Wordpress to Hugo?

You can search on Google for reasons why people move from Wordpress to Hugo. Many people are starting to move from Wordpress / Blogger to Hugo. Here are the reasons why I moved from Wordpress to Hugo:

Security

Wordpress is written in PHP, which currently has a bad reputation. Personally, I think Wordpress is actually good, even very good with features that are considered quite complete compared to Blogger or even Hugo.

In terms of themes, Wordpress might still be considered secure, as long as the auto-update feature for themes is turned on. But what about plugins? Well, most Wordpress plugins are made by professionals, but some are made by hobbyists. We never know what’s inside the Plugin files made by these “hobbyists”. It could potentially endanger our blog, one of the most common examples is giving backdoors or shells.

Speed

Every time you open a page in Wordpress, PHP will receive that request > Retrieve content from the Database > Retrieve images from the file system > Then all of this will be combined into one in the form of HTML > Only then will it be sent to the Browser that accesses the Wordpress page.

This process can be considered fast, especially if using PHP7, but it definitely won’t be as fast as pre-rendered HTML.

Wordpress shortcomings

  1. Continuous spam bots (even though Akismet, the anti-spam plugin, is used)
  2. Poor Gutenberg editor
  3. No version control

Summary of Steps for Migrating from Wordpress to Hugo

  1. Install Hugo locally via terminal
  2. Find a Hugo theme
  3. Export Wordpress content
  4. Fix Wordpress content
  5. Fix small errors in each article (hint - this is the longest step)
  6. Publish to web server
  7. More details on each step of migrating from Wordpress to Hugo are below.

Installing Hugo

Here, I’m using Termux, installing Hugo is quite easy, you can read the article How to Create a Blog with Hugo Using Termux. If you’re using Linux, you can follow the instructions here.

Finding a Hugo Theme

To find a Hugo theme, you can search on the official Hugo website. There are many mobile-friendly, simple, and feature-rich Hugo themes available.

The most popular Hugo theme right now is PaperMod Themes Hugo because it has the best features among other themes.

Exporting Wordpress Content to Hugo

Exporting content from Wordpress to Hugo is easy, you can use the plugin Wordpress to Hugo Exporter.

Fixing Small Errors in Each Wordpress Article

This is the most horrifying part for me, especially if there are already a lot of articles, it can take hours to fix these small issues.

  • Fix frontmatter (date, URL slugs, categories, featured image, etc…) make sure the new URL matches the old URL (for example, DEV site vs PRD site)
  • Remove Wordpress shortcodes and replace them with Hugo shortcodes
  • Search/replace images from URL path (for example, sekode.web.id/wp-contents/uploads) to relative path (for example, /wp-content/uploads)
  • Here I just remembered, I should have used Page Bundles from the beginning. It took hours to fix the images 🤣
  • Fix code snippets created using <pre> tags
  • Search/replace random character strings created by hugo (for example, _, *, [, -, `, <, .)
  • Use a lot of regex to find inter-blog links, bold text, underlined text, strikethrough text, and others…

Publishing Hugo Blog Site to Web Server

This step is very easy, you open the terminal, then type hugo server and it will automatically create the /public folder. For an easier way, I’ve already written an article on How to Host/Deploy Hugo on Github Pages. You can read that article to make it easier to migrate from Wordpress to Hugo.

What’s Missing from Wordpress When Migrating to Hugo?

  • Comments. All comments on your blog articles will be lost and cannot be restored to Hugo. This is somewhat disappointing, because comments on Wordpress are very important to me, but it’s okay, if you want to move, you have to be brave enough to take the risk of losing something, right? 🥲

Speedtest Hugo vs Wordpress

Here I show screenshots of the speedtest from Wordpress and Hugo. Hugo is faster than Wordpress.

Wordpress Speedtest

migration from wordpress to hugo

Hugo Speedtest

migration from wordpress to hugo

Conclusion

Do it at your own risk. I don’t recommend you to move from Wordpress to Hugo, but to be honest, at the beginning of my migration, I was completely confused because I wasn’t used to writing articles using Markdown, and I kept learning how to write articles in Hugo using this markdown system.

As a result, after trying and trying, I can now create articles in Hugo. The advantage is clear: Hugo doesn’t require hosting like Wordpress, just using a domain is enough to keep your blog alive until its domain expires.

We’re nearing the end of the article. If anyone has any questions about the Sekode article discussing How to Migrate a Blog from Wordpress to Hugo, feel free to ask in the comment section.