I am new to hugo
(but familiar with programming) and have some specific and some general queries. If anything reads funny, please assume error on my part.
The quick start guide mentions using git submodules
for theme management. That’s great!
But if you read just a bit enough past surface level, you run into some info about modules. It seems modules are a big part of the hugo ecosystem.
So, a somewhat open ended question: Between git sub-modules and go modules, is one or the other better way to manage themes? What are their respective trade-offs? Does the quick start guide prefer git submodules
for theme management over go modules
because the former has an easier learning curve? Seems like a pesky question but it looks like static site generation will be a fairly involved part of my day job for the near future and I am trying to build a foundation of tools and methods that are better supported and sustainable for the medium term future.
On the topic of theme management, I tried to play with a few themes using both git
and go
. And saw the following outcomes:
Ananke
Using git
Commands used
git init
git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke.git themes/ananke
echo "theme = 'ananke'" >> hugo.toml
hugo serve
outcome: Works!
Using go
commands used
hugo mod init www.sample.com
echo `theme = ["github.com/theNewDynamic/gohugo-theme-ananke"]` >> config.toml
hugo mod get -u
outcome: Works!
Paper-mod
using git
commands used
git init
git submodule add https://github.com/adityatelange/hugo-PaperMod.git themes/papermod
echo "theme = 'papermod'" >> hugo.toml
hugo serve
outcome: Works!
using go
hugo mod init www.sample.com
echo `theme = ["https://github.com/adityatelange/hugo-PaperMod.git"]` >> config.toml
hugo mod get -u
outcome : Failed
error
go: no module dependencies to download
go: added github.com/adityatelange/hugo-PaperMod v0.0.0-20240308054840-b5f7118d826e
hugo: collected modules in 658 ms
WARN 2024/03/09 21:12:43 Module "github.com/adityatelange/hugo-PaperMod" is not compatible with this Hugo version; run "hugo mod graph" for
more information.
Docsy
Using git
git init
git submodule add https://github.com/google/docsy.git themes/docsy
echo "theme = 'docsy'" >> hugo.toml
hugo serve
outcome: Failed
error
Error: module "github.com/FortAwesome/Font-Awesome" not found; either add it as a Hugo Module or store it in "/home/rijan/work_in_progress/h
ugo_troubles/docsy/git_submodule/themes".: module does not exist
Looks like some kind of missing dependency on the repo.
Using go
hugo mod init www.sample.com
echo `theme = ["github.com/google/docsy"]` >> config.toml
hugo mod get -u
outcome: Works!
So, in my limited testing, it seems like for some themes both go modules
and git submodules
work, for some one works and the other does not. So, a little jittery. I guess it comes down to the theme maintainer to maintain the theme’s dependencies and health. But the themes I tested are the themes on the Hugo themes landing page. So,
To people more familiar with hugo:
-
what has been your approach to theme management?
-
What do you use? What is more reliable in your experience?
-
Do you switch between one or other fairly often?
-
Are errors easier to chase down for
go modules
orgit submodules
?
Or are theme dependencies and health not really a big enough practical concern?