Hugo plus Netlify equals Love

It’s time to move my blog to version 3. This time we are going back in time and into the future at the same time.

Before we begin, here is a little history of my blog:

Version 1 - Blogger

Version 1 ran on Blogger - which was essentially a static site generation platform. It gave you an editor, you would write your posts and then it would generate your complete site in HTML and even allowed you to publish it on your own server by uploading the result via FTP.

That version didn’t last long and I quickly iterated to version 2.

Version 2 - WordPress

Version 2 was a self hosted WordPress site which I’ve been running on a server I manage. Throughout the years the servers changed but WordPress and its plugins persisted.

All in all it worked reasonably well, however, the need to constantly update WordPress (now less so because it has an auto upgrade feature), fighting off various hacks and backing up MySQL, even when most of it was automated, was still a pain I had to deal with.

This setup held for quite a while. I don’t even remember the version of WordPress I started with but it easily ran like this for more than 10 years.

Version 3 - Going static!

A lot have been said about static site generators, the JAMStack - Javascript, APIs and Markup and I’ve decided it worth taking the plunge.

I’ve decide to use Hugo - a static website generator written in Go.

Static site generators are kind of a step backwards in the sense that they generate static HTML files, similar to how blogs and other sites used to be before 1998 or so, however, these HTMLs can also utilize a lot of APIs to make the interaction as full as any dynamically generated site. In that sense we are moving forward light years.

In my opinion, using APIs (whether self hosted or platform hosted) encapsulates the essence of the web. A single seemingly simple site can be composed out of a lot of smaller services scattered around the internet. Some will provide authentication, other comments, others the ability to share the content while still making sure the owner of the content truly controls it.

Making the transfer

I’ve looked around and found a rather good WordPress plugin to export WordPress to Hugo including pages, drafts, images, you name it.

The plugin worked perfectly and I quickly had all of my posts in markdown - ready to be served by Hugo.

I created a new Hugo site, put the content generate by the plugin in the “content” folder and went on to select a theme.

The benefit is that everything (in a true UNIX spirit) is a file. Every post is a markdown file, every image is just a file etc. That means that I can easily host the site as a Git repository (public on Github and Bitbucket, or freely private on Bitbucket). That gives me history and backup (to some degree).

However, I still need to make sure all the files get to some kind of a server to get hosted.

I could use Github Pages but it has its own set of limitations, I put it on my own server or cloud bucket (S3 or Google Cloud Files) but then I would have to sync the files every time I add or change content.

That’s where Netlify comes in (Disclaimer: I’m an investor - but its still a cool tool I would gladly use any day!).

Netlify to the rescue

With Netlify I can easily deploy and host my static site with a single click. Future updates and content additions are published with just a simple Git commit (remember that with static sites its easy to have it revision controlled).

I also get other benefits that makes my life easier (and I’m a fan of being as lazy as you can):

  • Deployment triggers - Deploy when you commit to the associated git repository or using an API call.
  • CDN - Super fast ass kicking CDN for free (as in beer).
  • Previews - new deployment can generate a preview URL which you can check and deploy to the “production” version at a later time.
  • SSL - You get FREE (again, as in beer) SSL certificate using the wonderful Let’s Encrypt initiative.

With a little bit of work (about 1 hour) to make the transfer I saved myself:

  • Maintaining a server and all of its OS updates
  • Maintaining WordPress and all of its updates and its plugins’ updates
  • Backing up, restoring and checking WordPress’ MySQL database
  • Renewing my SSL certificate (or writing a script to renew the Let’s Encrypt certificate)
  • Use some site to monitor uptime (be it part of WordPress JetPack or something external like Pingdom)

If you have some time, please check Netlify, Hugo and the rest of the static site generators. It might help you be lazy like me for a few more hours per year :-)