By Lucas | March 1, 2018
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?
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.
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.
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.
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.