This article explains how to upgrade the theme correctly.

Versions

Before upgrading, it is necessary to introduce what a version is. In addition to the relative stable versions listed in Releases, you can use a branch such as master, develop, or even choose a certain commit.

This article will use the [version] placeholder to represent the version, just replace it with the version you want to upgrade to.

Upgrade

Please choose the upgrade step depending on the installation method: Git Submodule and Hugo Module.

Note that no matter which install method you use, you will always end up needing to pull and update dependencies via hugo mod npm pack and npm update.

Additional Dependencies

If you intend to add additional dependencies, you need to define it in package.hugo.json instead of package.json. That’s because the hugo mod npm pack will always override the package.json, which merges theme’s package.hugo.json and your site’s package.hugo.json.

Git Submodule

1$ cd themes/hugo-theme-bootstrap
2$ git fetch
3$ git checkout [version]
4$ cd ../../
5$ hugo mod npm pack
6$ npm update
7$ git add themes/hugo-theme-bootstrap package.hugo.json package.json package-lock.json
8$ git commit -m 'Bump theme to [version]'
  • git fetch pull the latest branch and tag information form the theme repository.
  • git checkout [version] switch to the [version] version.
  • hugo mod npm pack and npm update to pull and update the latest dependencies form the theme.

Hugo Module

1$ hugo mod get github.com/razonyang/hugo-theme-bootstrap@[version]
2$ hugo mod tidy
3$ hugo mod npm pack
4$ npm update
5$ git add go.mod go.sum package.hugo.json package.json package-lock.json
6$ git commit -m 'Bump theme to [version]'
  • hugo mod tidy clean up any redundant dependencies.
  • hugo mod npm pack and npm update pull and update the latest dependencies form the theme.