Sandboxing Hugo

Daily Standup

Got an intro to Hugo today! Yesterday's quick look into Gatsby showed me that I’m not ready to tackle a React site yet so today I looked into Hugo. I’m going to be building a site for a small business and it has a few requirements:

  • Cheap (ideally free)
  • Modern & responsive
  • Low maintenance
  • Full-feature blog
  • Easy for client to add/edit content

Using a static site & generator covers #1-4 and after looking into Netlify CMS, I think that will be # 5 covered as well. But Hexo doesn’t integrate as easily with Netlify CMS yet so I figured I’d give Hugo a try!

Hugo First Impressions

Really easy to get set up and give it a go. The syntax is very different but not impossible. The structure is not far off from Hexo and quite similar to Jekyll. Plus there’s great documentation and a video series which highlighted some of the main differences.

I also found this tutorial very helpful—it shows how to get started with Hugo, how to deploy the site to Netlify, and how to add Netlify CMS to the site. So exactly what I will be doing. 😋

Git Submodules

The quickstart tutorial recommended installing the theme as a submodule—never heard of that before! This keeps the theme separate from the site repo, basically a repo within a repo. To add the submodule to a project:

git submodule add https://github.com/path/to/repo

The bit that stumped me was handling changes. I made some changes to the theme, but they weren’t being added to git staging when I ran git add . in the project folder. I learned you have to commit changes in the submodule separately, and then commit that you made changes to the main project:

$ cd path/to/submodule
$ git add <stuff>
$ git commit -m "Make changes"

$ cd /main/project
$ git add path/to/submodule
$ git commit -m "Update submodule"

This was confusing at first, and apparently it gets way even more confusing when the submodule is a repo that’s shared by other people…although that is the main reason why you would use it—to use other bits of code which may itself get updates and changes regularly. In these scenarios, there’s a lot more to do for keeping the submodule up to date with the remote repo…I won’t really have to do that with this project though (luckily!). Found a pretty good article to read up on this though, if ever needed.

Up Next

Lots of plans tomorrow so not sure how much I’ll have time for, but next steps are to try a different theme, deploy to Netlify, and add a CMS to the test site.