Look Ma, I'm on Hugo!

Look Ma, I'm on Hugo!

By Lucas | March 1, 2018

Hugo Logo

The last couple months I’ve been playing around with migrating this blog over from WordPress to Hugo, the static site generator built on Go. Due to “reasons,” many of which probably don’t apply to the average WordPress blogger, and some of which involved me being finicky about certain expectations, this turned out to be more of a hassle than I anticipated. While the new version of the site has been up and running for over a month now, I’ve been slow to post because I’ve continued to spend my time tweaking and improving, but I can feel the old itch to write.

Why Go Static?

If you’re not familiar with static site generators, the idea is very different than a traditional CMS like WordPress. Whereas with WordPress, your content is dynamically generated for visitors from databases, with a static site generator, the content is generated upfront and static pages are transferred to a host to be served. If you’ve never heard of this concept before, and I hadn’t until early 2017, it might sound something like the 1990’s version of Dreamweaver and somewhat limiting. In fact, with the JAM Stack (Javascript, APIs, Markup), there are some pretty nice advantages, even for a non-developer like me.

Security

Since your entire site is developed offline and you’re uploading static pages, there isn’t much for hackers to get at. I’ve had WordPress sites hacked before despite taking fairly rigorous steps to secure them. There are just a lot of vulnerabilities there, and if you miss even one, forget it.

Markup

So markup is a pretty nice think to write in, particularly for data scientists who are used to writing in it for notebooks for Jupyter, RStudio, or Databricks. I’ve done a lot of writing in WYSIWYG editors, and what I’ve realized is this: What You See Is Not Always What You Get, Especially If You Add Code. That doesn’t seem to be the case with markup. There’s also the advantage that I can write offline and generate previews of my site offline.

Version Control

With static sites, you can version control the whole site in GitHub, GitLab, or whatever your favorite version control system is. No need to pay for additional backup beyond whatever you already use. If you already write code, you understand the advantage here and why you will sleep better at night.

Scalability

I’m not expecting this site to hit it big, but let’s say I think of something clever and it hits the front page of a popular subreddit. I’ve had it happen. You know what happened next, don’t you? It crashed my site, taking down the entire shared hosting server I was on. My host wasn’t happy, and I’m sure that the other business sharing the server weren’t either. What was the advice I was given? Use a caching plugin, as if I hadn’t thought of that. When serving static pages rather than a database, scalability should be far less of an issue.

Why Go Hugo?

So with the decision to go static out of the way, why choose Hugo? In the CMS world, most people in the open source community will go with WordPress, maybe some will go Drupal or Joomla. In the static site generator world, though, there are dozens of choices, and there isn’t such a dominant player. Still, I wanted a project with substantial open source momentum and support. I’m not a true web developer, so while I’m willing to tweak, I didn’t want to have to completely customize. Among the many static site generators out there, I looked at Pelican (Python) and Hexo (Node).

Ultimately, it came down to two choices for me, the two which seemed to have the most active communities. Hugo (Go) and the long running Jekyll (Ruby). I didn’t know either language but settled on Hugo for two reasons, it seemed like it would be fun to pick up a little Go along the way, and every benchmark I saw suggested Hugo builds sites much, much faster. I’m consider Hugo for another project with hundreds of pages and people were talking about build times in the tens of minutes at that scale, something I didn’t want to worry about.

Why Go Netlify?

So where to deploy my new site? Enter Netlify, the startup for deploying static sites. These guys could not make deploying your new static site any easier. Once you have it in your private repo, it is as simple as authorizing Netlify to access that repo and pushing a button to deploy the site. They offer features like:

  • Custom domains
  • Web forms
  • Free SSL
  • Global CDN

Some of the extras take a little time to set up, but here’s the thing, if all you’re doing is setting up a personal blog, the whole thing is free. It’s a great product.

So far, my experience with Hugo and Netlify has been unbelievably positive. While I’m still working to do some tweaks on the blog, when I find some time, I’d like to circle back around on migrating from WordPress to Hugo and talk a little more about Netlify.

comments powered by Disqus