Git Submodule
Prerequisites
You should install the following softwares before start:
- Hugo Extended, Version 0.146 or later
- Git
Steps
Init a new site
hugo new site my-site --format=yamlAdd hugo narrow as a git submodule
cd my-site
git init
git submodule add https://github.com/tom2almighty/hugo-narrow.git themes/hugo-narrowCopy 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 --disableFastRenderVisit http://localhost:1313 see your new site.
Update theme
To update ALL submodule, use the command:
git submodule update --remote --recursiveTo update theme submodule, use the command:
git submodule update --remote --recursive themes/hugo-narrowNote
See Git Submodule for more details.