2022-02-17

Jekyll to Hugo, GitHub to Cloudflare!

I never really was satisfied with Jekyll – I mean, the only reason I chose it as detailed in my first post here was that I wanted something easy to deploy, something I could just push some Markdown to and the post would be styled how I wanted it. And when I wanted to redesign the website, it would be easy to!

Indeed, it was already quite easy, with GitHub Pages doing the heavy lifting. But as I was redesigning the page, as easy Jekyll was to use, it felt a bit slow and I just didn’t feel like that was the last static site generator I would use. Hugo seemed like a good choice, with it being written in Go and highly recommended around the web.

So once that was sorted, I needed a new host, since GitHub Pages only supported Jekyll (not sure if I could’ve used GitHub’s CI, but anyway). Eventually, I landed on Cloudflare Pages. I already use Cloudflare for DNS, so I guess it made sense to just try it out. As a side bonus, they have a pretty cool subdomain if you don’t already have a domain name, in the format *.pages.dev – obviously I already have a domain name, but still pretty neat in my opinion anyway!

Once I had done the grunt work of learning the Go templating syntax and fought with Hugo for a bit to port over the site just how I wanted it, I was good to deploy. Cloudflare Pages is able to directly hook into my GitHub repo and just build the website on each push to the master branch which is quite convenient. However, I came across a problem on the first build:

Cloudflare Pages: Hugo build error on Hugo v0.54.0
Hugo build failed on the first try :(^

Scrolling up revealed that it was running Hugo 0.54.0, and I noticed my local version was 0.88.1 – so upon setting the HUGO_VERSION environment variable to 0.92.2, the latest version, everything was fixed! Not sure why Cloudflare Pages defaults to an older version (maybe since a version after breaks older pages?), but apart from this one hurdle, it was really very easy to deploy!

Oh, and for a blog this small (only 6 posts at the time of writing), I think this command output sums up my gripes with Jekyll:

nick@angel:/d/Dev/personal-web » time hugo >/dev/null

real    0m0.202s
user    0m0.000s
sys     0m0.015s
nick@angel:/d/Dev/personal-web » git checkout 2022-jekyll
Switched to branch '2022-jekyll'
Your branch is up to date with 'origin/2022-jekyll'.
nick@angel:/d/Dev/personal-web » time bundle exec jekyll build >/dev/null

real    0m9.454s
user    0m0.000s
sys     0m0.031s

To be clear, Jekyll did report about 4 seconds to build the pages once it was actually generating (not including the time for Ruby bundle to start up). However, just for putting some HTML bits-and-pieces together, that is way too long!

Ruby also was a bit more of a pain to setup on Windows – I know, why am I still here, but I think it’s still worth mentioning. Hugo was really easy and lighter to setup, especially since I used Chocolatey. While building the website, Hugo also came with hot-reloading out-of-the-box with the hugo serve server, which was a very welcome surprise.

I’m quite happy with the results so far, let’s see how it works out in the long run!