0009: Use Module for Hugo Theme
Context
https://gohugo.io/hugo-modules/use-modules/#use-a-module-for-a-theme
Decision
$ cd /theme/
$ hugo mod init github.com/imomaliev/blog
$ git add go.mod
$ git commit
$ git push
$ cd ../site/
$ hugo mod init github.com/imomaliev/blog
$ hugo mod get github.com/imomaliev/blog/theme
$ hugo mod get -u
$ hugo mod tidy
NOTE: hugo mod tidy will remove github.com/imomaliev/blog/theme from go.mod, making go.sum useless.
We can just rm go.sum
Replacement for local development
[module]
+ replacements = 'github.com/imomaliev/blog/theme -> ../../theme'
+
+ [[module.imports]]
+ path = 'github.com/imomaliev/blog/theme'
$ hugo mod get github.com/imomaliev/blog/theme
go: no module dependencies to download
go: github.com/imomaliev/blog/theme@upgrade: no matching versions for query "upgrade"
hugo: collected modules in 558 msError: failed to load modules: failed to get ["github.com/imomaliev/blog/theme@upgrade"]: failed to execute 'go [get github.com/imomaliev/blog/theme@upgrade]': failed to execute binary "go" with args [get github.com/imomaliev/blog/theme@upgrade]: go: github.com/imomaliev/blog/theme@upgrade: no matching versions for query "upgrade"
No go.mod in theme folder in github