3 minutes
Migrating from Wordpress to Hugo
Since I bought this domain, I’ve been hosting a wide variety of things behind it.
A ridiculously obvious phishing website with a Verified Badge, images of cats, … and eventually a WordPress blog.
While WordPress is a nice tool to work with when you just want a website/blog, I wasn’t very happy with it.
If you go the easy route of hosting a blog at WordPress.com, you’ll need a premium account to be able to use your own domain name.
Also, you won’t be able to use plugins, custom CSS, etc.
The alternative is to host a WordPress install on a VPS or a webserver at home. This gives you much more freedom in installing plugins, installing themes, using custom CSS and more.
However, I still felt too limited in what I could do with the site.
And I didn’t like the amount of tracking WordPress did, especially if you linked your install to JetPack.
Requirements ¶
I was looking for an alternative that could at least fulfill the following requirement (random order):
- be able to use templates, since my webdesign skills are pretty basic;
- I don’t want to have to write my blogs posts (completely) in HTML, I prefer writing in something like Markdown and transforming that to the correct output;
- static website, I don’t want dynamic stuff that could lead to exploits (also doesn’t require me to keep track of updates);
- privacy-by-default, i.e. no included trackers, like buttons, etc.;
- free and open-source;
- allow for customisation;
- no vendor lock-in; and
- I want to be able to automate deployment.
As such, I ended up at Hugo.
With Hugo, I still have access to a wide catalogue of free and premium templates, which immediately give the website a more profesional look. Hugo also gives you a lot of options to customise your website, allowing you to change practically anything you want.
Writing blog posts is a breeze, since I can work in Markdown, which is super easy.
Also, since I write most of my notes in Markdown anyway, it’s very easy to copy snippets from these notes into my blog.
Moving content from WP to Hugo ¶
Luckily I’m not the only person to ever want to migrate from WP to Hugo. After a bit of online searching, I stumbled upon a Wordpress to Hugo exporter.
This tool allowed me to quickly make an export of my Wordpress blog, already converted to Markdown and including the YAML header.
You basically just have to install the plugin, execute it and extract the generated zip file.
I even updated the tool’s README to reflect the steps I took to export my website, contributing back to the OS community.
Note that the output may still include some WordPress-specific HTML tags, especially when you’re using the newer Gutenberg editor.
I had to fix all my code blocks, since I used the new code blocks with syntax highlighting.
Also, since WordPress stores images in a different folder structure, you may need to change the paths in your posts if you plan on starting with a fresh install (like I did).
If you have some experience with sed
to search and replace strings, you should be able to most of it.
Conclusion ¶
I’ve moved away from WordPress around the end of January and I’m writing this blog post around the end of March.
So far I’ve been very happy with using Hugo for this website.
This week I still discovered some WordPress remnants I could get rid of and some images still had a wrong URL. However, you won’t be encountering this if you start of with Hugo right from the beginning.
There’s definitely still a lot more I can do with Hugo, which I’ll discover along the way. And I’m looking forward to implementing this new knowledge.