Hugo Themes
Add a Theme
You will usually want a theme. Go to the root folder of your new hugo project. There are many themes. I’m going to cover the hugo techdoc theme only. There are many pre made ones that you can modify: https://themes.gohugo.io/
git submodule add https://github.com/thingsym/hugo-theme-techdoc.git themes/hugo-theme-techdoc
Initialize and update submodules
git submodule update –init –recursive
Start the Hugo Server With Theme
To start the server with the theme, you will need the specify it
hugo server -t hugo-theme-techdoc
or
hugo server --noHTTPCache --disableFastRender -t hugo-theme-techdoc
Theme Editing
Understanding golang will help make sense of editing the scripting, but the scripting is not required too.
https://gohugo.io/variables/page/
Sample Site
https://thingsym.github.io/hugo-theme-techdoc/sample/
Update Theme
I received error about depreciated tags in my theme/go.
ERROR deprecated: .Site.IsServer was deprecated in Hugo v0.120.0 and will be removed in Hugo 0.138.0. Use hugo.IsServer instead.
Built in 639 ms
Error: error building site: logged 1 error(s)
So I updated with this command
git submodule update --remote --merge
The result:
remote: Enumerating objects: 199, done.
remote: Counting objects: 100% (199/199), done.
remote: Compressing objects: 100% (53/53), done.
remote: Total 199 (delta 105), reused 198 (delta 104), pack-reused 0 (from 0)
Receiving objects: 100% (199/199), 119.47 KiB | 1.93 MiB/s, done.
Resolving deltas: 100% (105/105), completed with 42 local objects.
From https://github.com/thingsym/hugo-theme-techdoc
c6653ba..225f4a9 develop -> origin/develop
5b0f876..a23ede6 gh-pages -> origin/gh-pages
efa9d44..56dca59 master -> origin/master
* [new tag] v1.0.1 -> v1.0.1
Updating aca0800..56dca59
Fast-forward
.github/{demo_config.toml => demo_hugo.toml} | 10 +-
.github/workflows/gh-pages.yml | 10 +-
.gitignore | 2 +
README.md | 28 +-
docker-compose.yml => compose.yml | 5 +-
exampleSite/content/chapter3/_index.md | 2 +-
exampleSite/content/chapter4/_index.md | 2 +-
exampleSite/content/getting-started/_index.md | 2 +-
.../content/getting-started/configuration.md | 16 +-
.../content/getting-started/installation.md | 4 +-
exampleSite/content/post/creating-a-new-theme.md | 36 +-
exampleSite/content/post/goisforlovers.md | 6 +-
exampleSite/content/post/hugoisforlovers.md | 4 +-
exampleSite/content/post/migrate-from-jekyll.md | 14 +-
...ild-in-shortcodes.md => built-in-shortcodes.md} | 4 +-
exampleSite/{config.toml => hugo.toml} | 4 +-
layouts/partials/meta/google-analytics-async.html | 2 +-
.../partials/meta/google-site-verification.html | 2 +-
layouts/partials/meta/tag-manager.html | 2 +-
layouts/partials/prepend-body.html | 2 +-
package-lock.json | 11469 ++++++++++---------
package.json | 40 +-
src/scss/_component.scss | 1 -
static/css/theme.min.css | 2 +-
static/js/bundle.js | 2 +-
25 files changed, 6162 insertions(+), 5509 deletions(-)
rename .github/{demo_config.toml => demo_hugo.toml} (91%)
rename docker-compose.yml => compose.yml (70%)
rename exampleSite/content/sample/{build-in-shortcodes.md => built-in-shortcodes.md} (89%)
rename exampleSite/{config.toml => hugo.toml} (99%)
Submodule path 'themes/hugo-theme-techdoc': merged in '56dca591b7b45c9eb81c7c8724515354378a88f3'