How to setup Hugo's theme using git submodule

Recently, I have setup new machine and like to document something that I found useful via my blogs which is hosted using Hugo which I think the best static site generator built using Go.

I setup the theme using the git-submodule so this is the script that I use to get the site up and running locally.

What you will need

Setup the git-submodule to work with Hugo

Hugo expect the theme to reside under themes, if you do this manually you will normally run the following command to install a given theme.

# Change directory to the root of the root folder of Hugo
cd /path/to-your/hugo-site/

# Change directory to the theme directory
cd themes

# Clone your favourite themes to this folder
git clone

If you are using git-submodule you will first need to add it to your repository

git submodule add themes/hyde-x

To actually use the code in hyde-x theme above you can then run

git submodule init
git submodule update

So you should now be able to start Hugo normally

## file: ./start-hugo-preview
## Start hugo in the development mode, port will be added.
## Note:
## - For fresh install on the new machine
## $git submodule init
## $git submodule update # to fetch the git submodule to local directory
hugo server -t hyde-x --watch

Useful links

comments powered by Disqus