Igor Kulman

Going static: From Wordpress to Hugo

· Igor Kulman

As you may have noticed, static site generation is the next big think. When I created this blog a few years ago I choose Wordpress, because it seemed like a good choice. Now I have grown tired with updating plugins, exchanging broken plugins for alternative ones and so one. So I decided to try to go the static site generation route to make the blog easier to maintain.

Jekyll? Octopress? FsBlog? Hugo!

There are quite a few static site generators out there, so choosing the right one is quite a challenge. Jekyll or Octopress seemed like the obvious choice. Jekyll requires Ruby, which is ok even on Windows, but Octopress had a few dependencies that I did not manage to get working on Windows. FsBlog seemed interesting, especially for me being a F# enthusiast, but frankly it is not yet very usable. So I choose Hugo.

Hugo is a static site generator written in Go. That means no dependencies, just one binary you download and use. On Windows, you can even get it using Chocolatey. It has a nice tutorial, a lively community and a few ready made themes.

Getting the content from Wordpress

If you are coming to Hugo from Wordpress, there is a plugin to export all the content for you. The only problem with the plugin is that it completely ignores Gists you reference in your posts. So after you export your posts, you have to manually edit one by one and add the Gists. Some Hugo themes offer you ready made shortcodes for embedding Gists.

Hosting on Github Pages

One of the things I wanted to try after switching to a static website was hosting it on Github Pages, because the Git deployment story is more comfortable than copying or syncing the generated content over FTP to my hosting provider. Github Pages also offer kind of a CDN for your content. Setting it all up is not very complicated, there is a tutorial in Hugo documentation that will walk you through the process.

However, there are a few limitations when using with Github Pages. There are no redirects, so I could not redirect my RRS feed to the new one. A much bigger problem is that there is no way to set caching time for static resources like CSS and JS files.

See also