This article refers to the traditional installation method of cloning the theme locally as Git submodule. While this installation method is still widely used, we recommend to install the theme as Hugo module.


1$ git clone myblog
2$ cd myblog
3$ git submodule add themes/hugo-theme-bootstrap
4$ sed -i "s/theme:.*/theme: hugo-theme-bootstrap/g" config/_default/config.yaml
5$ rm go.mod go.sum
6$ hugo mod npm pack
7$ npm install
8$ hugo server

如果你使用的是 Windows,請改用 xcopy .\themes\hugo-theme-bootstrap\exampleSite /E

sed replaces the theme: with theme: hugo-theme-bootstrap.


 1$ cd myblog
 2$ git submodule add themes/hugo-theme-bootstrap
 3$ git clone /tmp/hbs-skeleton
 4$ mkdir config
 5$ cp -a /tmp/hbs-skeleton/config/* ./config
 6$ cp -r /tmp/hbs-skeleton/content/* ./content
 7$ cp -r /tmp/hbs-skeleton/archetypes/* ./archetypes
 8$ cp -r /tmp/hbs-skeleton/static/* ./static
 9$ cp -r /tmp/hbs-skeleton/assets/* ./assets
10$ sed -i "s/theme:.*/theme: hugo-theme-bootstrap/g" config/_default/config.yaml
11$ hugo mod npm pack
12$ npm install
13$ hugo server

如果你重新尅隆倉庫,你將需要通過 git submodule update --init --recursive 更新 submodule,或者 git clone --recursive <repo>