This past weekend, I switched this blog site from WordPress to Hugo, a static site generator.
I checked out Hugo a few weeks back and was surprised at how user-friendly it was. Getting started felt smooth and effortless.
In this post, I will explain why I switched from WordPress and how I successfully migrated my site in just a few hours on a weekend afternoon.
Why I moved from WordPress to Hugo Link to heading
WordPress has been my go-to anytime I need to build something without custom features or significant user-generated content. WordPress and the plethora of plugins were easy enough to set up and maintain.
While WordPress offers a lot of flexibility, I found it a bit feature-heavy for my simple blogging needs and has no version control.
Why Hugo Link to heading
You can search for “WordPress to Hugo” on Google and find numerous posts discussing why people make the switch. Here are my reasons:
- It is blazing fast. My blog builds in ~ 1 second.
- Content as Markdown. Owning your content and knowing it’s not locked up with a vendor or in a database gives you peace of mind.
- I like working with plain old HTML and CSS. The templating language allows me to do that.
- The development and support community are top-notch.
- Host the built site anywhere you want.
- Hugo’s single binary (few dependencies) makes it incredibly portable.
Getting Started Link to heading
Setting up a local environment is easy, quick, and lightweight. Visit the official site and follow the documentation there.
I run macOS, so installing Hugo was easy.
Once that’s done, select a theme and follow its instructions, and you are good to go.
This blog runs on Hugo-Coder theme.
Migrating content Link to heading
Hugo’s official migration tutorial recommends several tools to export posts from WordPress.
I used the wordpress-export-to-markdown converter, which produced much cleaner output, but no comments.
I also tried the below tools as well, but settled on the above:
Keep URLs Unchanged Link to heading
Another crucial issue after transitioning to Hugo is ensuring that the previous URLs remain unchanged. On one hand, the new URLs of posts should stay consistent with those in WordPress. In my situation, I incorporated the following settings into the Hugo configuration.
permalinks:
page:
posts: '/:year/:month/:slug/'
projects: '/project/:slug/'
section:
posts: '/blog'
projects: '/projects'
This is documented and can cover various scenarios.
Publish to webserver Link to heading
Deploying the website was a breeze. Run hugo server
to generate the static content. This creates a /public
folder that you can compress into a ZIP and securely transfer to your web server via SFTP.
I set up a GitHub Actions workflow based on this post to automate this process. This workflow streamlines site-building and synchronizes it with the web server using rsync.
Top comments (0)