Migrating to Hugo and GitHub Pages

I wanted to have greater control over my blog, so I’ve been thinking about moving it to a self-hosted WordPress installation. In the end, I decided to migrate from WordPress to a static blog generated with Hugo and hosted on GitHub Pages. This post will be the last one posted on reusingthewheel.wordpress.com – the future ones will be posted on piotr-rusin.github.io.

Why a static website generator?

I like the convenience of writing content (including tags, categories and other metadata) in markdown, in my editor of choice, saving it to a file and running a few console commands to rebuild my website and send updates to a server. Static website generators, combined with a couple of Git repositories (one for templates and content and the other for generated static website) and a GitHub account allow me to enjoy it.

Another reason for my choice is that static HTML files can be hosted anywhere, with minimal to no setup. I can even get a reliable, efficient and ad-free hosting for free.

Although no HTML is generated server-side, static website generators still use web templating systems, with all their advantages, like separating data from presentation, allowing me to easily update or replace the latter without having to deal with too much repetitiveness in template code.

Finally, there are security and performance concerns regarding WordPress and other dynamic website engines and web applications (but especially WordPress, judging from both its reputation and popularity). Their complexity and reliance on storing data in database introduce both a potential for bugs that may allow unauthorized access to sensitive data and an overhead in handling HTTP requests. Using a static website generator allows me to avoid these issues without effort.

User interactions and contributions

I’m the only author of this blog and I don’t plan to change that. However, I want potential readers to be able to post comments below my posts, and it’s obviously impossible without a server side application for managing comments and data of their authors. Luckily, there are third party comment systems like Disqus or Discourse. One’s website needs only to contain a piece of JavaScript code responsible for communicating with a server of such a system and presenting comments, so it can be easily integrated with a static website. When I was still planning to move to a self-hosted WordPress installation, I was going to use such a system anyway, mainly because I didn’t want to force my readers to register on yet another website if they wanted to both comment and use a persistent account for that.

Choosing the right tool

I must admit I didn’t do a lot of research before making the choice. I only considered Jekyll, Pelican and Hugo, and I chose the latter for:

  • its relative popularity – it’s second (after Jekyll) according to data presented on StaticGen
  • ease of setup – unlike Jekyll and Pelican, Hugo is distributed as a static binary, ready to be put and executed anywhere
  • speed – rebuilding even large websites is said to be much faster than in case of Jekyll

After downloading Hugo, trying it out and using it to do a test migration of my blog, I decided I didn’t need to look further.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s