Are there any advantages to using Go Modules vs git submodule for something like installing a theme? Wondering what the recommended way is going forward. Asking from two perspectives:
Should I migrate existing sites to use Modules (if the theme is set up correctly for go modules)?
Should the Quickstart instructions use Go Modules instead of a git submodule if that’s the recommended way?
Go modules require
golang be installed, where git submodules just require git. After that I think it’s preference.
Well, hugo modules are dope as hell. That’s also for consideration.
I prefer remembering to
hugo mod init on each project than recalling the git submodules commands, as I use either rarely.
Thanks, been looking over the Modules docs but missed that. I’m sure there’s a lot of users that install hugo without installing golang, if documenting something I’ll prob go the git submodule way.
Yea, I’m in the same boat with occasional use of many things, actually the reason for the new site that’s behind this question!
While that is true for when you’re doing “theme development”, once it is stable you can do “hugo mod vendor”.
We do that for the Hugo Docs and the Hugo Themes site (we only have one module there, the theme, but the concept is valid), which give us 2 benefits:
- Users who want to run the docs site locally only need Hugo installed (no Git, no Go)
- The repo has everything needed to run the site committed to GitHub – meaning we can include the full docs site source (with theme etc.) in the /docs folder of the Hugo main project in the source distribution. Meaning you can the download v0.56 source and browse the docs at that point, without having to download anything more.
Thanks for the heads up, I’m that much closer to grokking modules. I suppose I could go hunting on GitHub for repos with modules, I haven’t seen many examples in the wild, so nearly everything I’ve learned is from one of your example repos or a comment here; slow and steady.
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.