Getting Started

This article describes how to install, upgrade the theme, and write new articles.

Installation

Required Hugo 0.75.0 or above.

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 server

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

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 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$ git add themes/hugo-theme-bootstrap
6$ 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.

Write Articles

Suppose the default language is en.

1$ hugo new posts/new-post/index.md

The command above create a new post written in English. Similarly, we can create a post written in Simplified Chinese:

1$ hugo new posts/new-post/index.zh-cn.md

Please remind that, the created posts are generally in draft state. You’ll need to specify the -D parameter of the command hugo server for previewing. Similarly, you need to change the draft to false or remove draft parameter if you want to publish the article.

You can place your posts anywhere, such as blog, what you need to do is just append the blog to the mainSections parameter: mainSections = ["posts", "blog"].

Up Next

Copyright

Comments