Adding a theme as a submodule or clone?

There is a third option (as seen in https://github.com/gohugoio/hugoDocs/tree/master/themes/gohugoioTheme), which is a git subtree …

Which I guess makes the confusion complete, I guess …

I would say this:but

Submodules is, in most cases, your best choice. You can easily pull in updated theme(s) when needed.

Assuming your project is already a git project, then git clone sounds a little weird, and we should probably fix that. It may be a good option if your site isn’t a Git project. I.e. git clone some theme and then delete .git folder. Maybe also if you plan to use a theme as a starting point and never intend to synch in changes from the source.

The reasons why we use sub tree in the docs site is mainly:

  • We have a “mirror” of the docs in the main Hugo project (below /docs), so /docs is a subtree with the theme as another subtree …
  • Ready to build (hugo server) documentation is with this automatically packaged as part of the source distribution when we release, including theme and all.
  • We can also add documentation changes as part of the code changes in the same PRs if we need to.
3 Likes