This article refers to the traditional installation method of cloning the theme locally as Git submodule. It describes how to install, upgrade the theme, and write new articles. While this installation method is still widely used, we recommend to install the theme as Hugo module .

Installation

Create a New Site from Scratch

1$ hugo new site myblog
2$ cd myblog
3$ git init
4$ git submodule add https://github.com/razonyang/hugo-theme-bootstrap themes/hugo-theme-bootstrap
5$ cp -a themes/hugo-theme-bootstrap/exampleSite/* .
6$ hugo mod npm pack
7$ npm install
8$ hugo server

If you’re using Windows, use xcopy .\themes\hugo-theme-bootstrap\exampleSite /E instead.

Now, at the top of your config/_default/config.toml, remove the hash sign at the beginning of the theme =` line in order to activate your theme:

1theme = "hugo-theme-bootstrap"   # when adding theme as git submodule

Install on an existing site

 1$ cd myblog
 2$ git submodule add https://github.com/razonyang/hugo-theme-bootstrap themes/hugo-theme-bootstrap
 3$ mkdir config
 4$ cp -a themes/hugo-theme-bootstrap/exampleSite/config/* ./config
 5$ cp -r themes/hugo-theme-bootstrap/exampleSite/content/about/ \
 6  themes/hugo-theme-bootstrap/exampleSite/content/archives/ \
 7  themes/hugo-theme-bootstrap/exampleSite/content/categories/ \
 8  themes/hugo-theme-bootstrap/exampleSite/content/contact/ \
 9  themes/hugo-theme-bootstrap/exampleSite/content/offline/ \
10  themes/hugo-theme-bootstrap/exampleSite/content/search/ \
11  themes/hugo-theme-bootstrap/exampleSite/content/series/ \
12  themes/hugo-theme-bootstrap/exampleSite/content/tags/ \
13  ./content
14$ hugo mod npm pack
15$ npm install
16$ hugo server

If you’re making a fresh clone, you will be need to update your submodule via git submodule update --init --recursive or clone with submodule git clone --recursive <repo>.

Upgrade

1$ cd themes/hugo-theme-bootstrap
2$ git fetch
3$ git checkout [version]
4$ cd ../../
5$ hugo mod npm pack
6$ git add themes/hugo-theme-bootstrap package.json
7$ git commit -m 'Upgrade the theme'
  • Replace the [version] with the latest version. The version can be listed by git tag -l | sort -rV.
  • You can also checkout the master branch for getting the latest commit.