Use a package instead of a git submodule for themes

Whilst git submodules seem to be very useful they unfortunately tend to cause many more issues than they solve. Therefore I would recommend that it be planned to migrate away from submodules and have themes be installed as if they were a dependant package which would be similar to other ways of working within software and web development.

That’s a good idea and has already happened. You can use hugo mod commands to import a theme or whatever from a Git repository, which is configured as a Hugo module.

Hugo modules rely on Go modules, so you need a Golang environment for them to work.

The documentation for Hugo modules is still developing, you may have to look for examples here in the forum. But they are quite easy to use, once they are configured.

1 Like

Ah so it’s a case of docs needing updated more than it not being a thing. That makes sense and would massively help with other testing that I am doing for some sites going forward, I’ll have a play around this weekend and over the next week or so and hopefully get my actual issue sorted out.

Yes, modules are a mature feature to import nearly every external source. You only need Git submodules, when you are working on a theme or other kind of module yourself.

@kilasuit - how you “install” a theme is totally up to you. The usual approaches I see, in no particular order:

  • via git submodule
  • via hugo modules
  • via a download of the theme git repo then unzipped into the appropriate place
1 Like