Git Submodule

Prerequisites

You should install the following softwares before start:

Steps

Init a new site

hugo new site my-site --format=yaml

Add hugo narrow as a git submodule

cd my-site
git init
git submodule add https://github.com/tom2almighty/hugo-narrow.git themes/hugo-narrow

Copy example site files

Copy all files of ~/themes/hugo-narrow/exampleSite/ to the root folder of the site.

Make sure the configuration at ~/config/_default/hugo.yaml is right: theme: hugo-narrow.

Note

If you need to modify the theme, copy the theme files you want to modify to the same path in the root directory of your site and define your modifications there.

With this method, you cannot commit modifications to GitHub. If you want to save your modifications to a GitHub repository, you can fork the theme and then replace the submodule added via git submodule with your repository address.

Localhost preview

hugo server --buildDrafts --disableFastRender

Visit http://localhost:1313 see your new site.

Update theme

To update ALL submodule, use the command:

git submodule update --remote --recursive

To update theme submodule, use the command:

git submodule update --remote --recursive themes/hugo-narrow

Note

See Git Submodule for more details.