Moving From Jekyll to Hugo
This site is hosted on github pages and until today was built using Jekyll. I would push commits and github would rebuild the site for me. Locally I pulled in the github-pages gem so I could preview my site (you can read more about that here). Last week I got a notification that one of my gems had a security vulnerability so I updated everything. I had to update my ruby version which made bundler happy but broke vim. Then I updated vim which caused vim to be incompatible with my python version. After I finally got bundler and vim working and committed my changes the next github pages build broke my site and spewed a bunch of broken HTML.
I had been wanting to try hugo anyway so rather then spend my Saturday debugging Jekyll I made the switch.
Setting Up Hugo
Since github doesn’t build hugo sites automatically the setup is a little different. You need to create a new repo to hold the source (mine is yuloh/blog) and push the generated code to your pages repo. These are the basic steps I followed:
- Create a new hugo site following the quick start guide
- Copy all the posts from Jekyll’s
_postsdirectory to Hugo’s
content/postsdirectory and update the front matter.
- Copy all the drafts from Jekyll’s
_draftsdirectory to Hugo’s
content/postsdirectory and update the front matter, adding
- Copy all the assets from Jekyll’s
assetsdirectory to Hugo’s
- Setup syntax highlighting with Chroma and copy over my Rouge theme.
- Delete everything but the CNAME from my github pages repo.
- Follow this guide to add my github pages branch as a submodule.
Everything is really fast. The hugo server takes around 200 milliseconds to boot. Jekyll takes about 3 seconds. Livereload takes 20 milliseconds with Hugo; Jekyll takes 2 seconds.
Everything is Simpler
This is a big one for me. Installation is simple. I just have to download the hugo binary and that’s it. No ruby version requirements, no bundler, nothing. It’s great. Instead of using liquid tags to link to assets you just use the path. You don’t need to include the date in the file name. You can easily publish a post by deleting
draft: true from the frontmatter. You can override theme files by creating a file at the same path in
/static. This is subjective but I much prefer
yaml for config files.
I originally used Jekyll because I didn’t have to build and deploy myself but it’s pretty easy with hugo. The published site is just a submodule and the example script from the hugo docs makes publishing a single command.
I’m enjoying Hugo so far. If you were thinking about making the switch I would suggest giving it a try.