Recently, I have upgraded the theme for this blog.

Upgrading a theme for your Hugo site

At first, I used git subtree to add a theme to my Hugo site, but it turned out that it would not work properly. That is, it undesirably brings all of the history of your installed theme to your Hugo site. It was my mistake.

To add a theme to a Hugo site, you should just use git clone, as described in the official tutorial. Then, you can run git pull in your theme directory to upgrade the theme.

Adding a menu to your Hugo site

My blog did not have a menu. It did not present links to a list of categories and a list of tags. I did not know how to do that.

It was quite easy to define menus for a Hugo site. Hugo themes refer to the site metadata for menu definitions. This is awesome, as the menu contents remain unchanged even if you switch to another theme. All you have to do is to add a corresponding section to your config.toml (or config.yaml/config.json/etc.):

[menu]
  [[menu.main]]
    name = "Categories"
    url = "/categories/"
    weight = 100
  [[menu.main]]
    name = "Tags"
    url = "/tags/"
    weight = 100
  [[menu.main]]
    name = "GitHub"
    url = "https://github.com/akirak"
    weight = 200

There is a documentation on menus, but I actually looked at this thread for an example of menu configuration.

My blog now has a list of categories, a list of tags, and a link to my GitHub account.

Hugo version on Netlify

After upgrading the theme, Netlify failed to compile my site. I referred to the log and knew that the latest version of my theme requires Hugo version 0.20, which is newer than the version of Hugo that was installed on Netlify.

Thanks to a stuff at Netlify, I learned how to specify a Hugo version for deployments on Netlify. You can specify a Hugo version by creating a file named netlify.toml like this:

[context.production.environment]
  HUGO_VERSION = "0.20"

After applying this change, my blog successfully built on Netlify. Netlify is awesome.