This article refers to the modern, up-to-date installation method of installing the theme locally as Hugo module. It describes how to install, upgrade the theme, and write new articles.
Proxy (optional)
If you’re located at China mainland without VPN, the Hugo module download may fail.
There are two proxies for this: GOPROXY.CN and GOPROXY.IO .
or
Installation
Install a new site from scratch
Step 1: Create skeleton site
- Create and enter new site:
Step 2: Turn your new site into a Hugo module:
Step 3: Declare hugo-theme-bootstrap module as a site dependency:
Step 4 (optional): Copy example site content into your site
- Clone the
hugo-theme-bootstrap
repo into a temporary directory:
If you’re using Windows, use
git clone https://github.com/razonyang/hugo-theme-bootstrap %temp%\hugo-theme-bootstrap
instead.
- Copy example site content:
If you’re using Windows, use
xcopy %TEMP%\hugo-theme-bootstrap\exampleSite /E
instead.
- Remove your file
config.toml
- Delete the repo from your temporary directory again:
At the top of your config/_default/config.toml
, switch the uncommented theme:
1# theme = "hugo-theme-bootstrap" # install via git submodule
2theme = "github.com/razonyang/hugo-theme-bootstrap" # install via hugo module
Step 5: Pull in dependencies via npm
- Use node package manager
npm
to pull in dependencies for this theme:
Step 6: Preview your site
- Start hugo’s built-in webserver to preview your website:
Install on an existing site
Step 1: Turn your existing site into a Hugo module:
Step 2: Declare hugo-theme-bootstrap module as a site dependency:
Step 3 (optional): Copy example site content into your site
- Clone the
hugo-theme-bootstrap
repo into a temporary directory:
- Copy example site configuration and content into your site:
1$ mkdir config
2$ cp -a /tmp/hugo-theme-bootstrap/exampleSite/config/* ./config
3$ cp -r /tmp/hugo-theme-bootstrap/exampleSite/content/about/ \
4 /tmp/hugo-theme-bootstrap/exampleSite/content/archives/ \
5 /tmp/hugo-theme-bootstrap/exampleSite/content/categories/ \
6 /tmp/hugo-theme-bootstrap/exampleSite/content/contact/ \
7 /tmp/hugo-theme-bootstrap/exampleSite/content/offline/ \
8 /tmp/hugo-theme-bootstrap/exampleSite/content/search/ \
9 /tmp/hugo-theme-bootstrap/exampleSite/content/series/ \
10 /tmp/hugo-theme-bootstrap/exampleSite/content/tags/ \
11 ./content
- Delete the repo from your temporary directory again:
At the top of your config/_default/config.toml
, switch the uncommented theme:
1# theme = "hugo-theme-bootstrap" # install via git submodule
2theme = "github.com/razonyang/hugo-theme-bootstrap" # install via hugo module
Step 4: Pull in dependencies via npm
- Use node package manager
npm
to pull in dependencies for this theme:
Step 5: Preview your site
- Start hugo’s built-in webserver to preview your website:
Theme Upgrade
- Invoke hugo’s module
get
subcommand with the update flag:
Hugo will automatically pull in the latest theme version.
If you want to set your module to a certain
version
inside thehugo-theme-bootstrap
theme repo, simply specific the name of the tag representing this version when updating your theme.
Instead of a version tag, you can also specify a commit hash inside the repo (here:
de4a40f
) when updating your theme:
Comments