Question(s): Are modules within modules available in the root module?

This might sound like a stupid question, but better it’s being asked by me than by anyone else :wink:

I have a moduling website. The repo structure looks like the following:

Root Website Repo (content and some setup)
|- Theme repo (the theme)
   |- library repo (bootstrap, for instance)
|- some fonts repo (some local fonts)
|- Shortcodes

So theme, fonts and shortcodes are configured in the go.mod/config.toml of the root repo and the library repo is configured in go.mod/config.toml of the theme module.

Running hugo server in the root repo I would have expected to have all five modules available with their mounts, but it seems, that the SCSS pipe in the theme repo does not find the scss files in the library repo.

Question 1: How can I see what is mounted where? It seems there is no hugo mod command for that. It would be nice to see somehow a list of mounts and their contents.

Question 2: Am I wrong to assume, that the library repo should be available when running hugo server in the root repo?

hugo config mounts

List the mounts.

  1. Yes; as I have used similar setups many times before, I assume you are doing something wrong.

Could it be that hugo collects it’s mounts from the files in /tmp/hugo-cache and not the replace path set up in my go.mod? hugo config mounts is great. I see it even mounts js-config (I understand that release note now, hehe) but it does not show the library module (which I might have added after my last push to the repositories).

No…

That command shows me all mounts on the first level, not what is mounted in the theme module.

Another observation: when I do

hugo mod get github.com/davidsneighbour/dnb-hugo-libs/bootstrap4

nothing happens to my go.mod, but doing

hugo mod get github.com/davidsneighbour/dnb-hugo-libs

will add a line in the require section. The repo (GitHub - davidsneighbour/libraries: A collection of "bridges" to the tools that are being used in DNB Hugo elements.) has no go.mod, the subdirectory has.

Also, running a “recursive” update after doing and pushing changes to the theme repo and the library repo result in a note only about the theme repo being updated:

[21:49:46][patrick@bookra] ~/Projects/Me/samui-samui.de (+1|%0|!12997|0)
❯ hugo mod get -u ./...
Update module in /home/patrick/Projects/Me/samui-samui.de
go: github.com/davidsneighbour/dnb-hugo-garuda upgrade => v0.0.0-20201015144906-976865ce31f4
patrick@bookra:/dev/pts/0>~/Projects/Me/samui-samui.de

I’ll try to get a testable construction to Github. Pretty sure something is configured wrong along the lines.

It shows all active mounts, including any theme module mounts. Which is why it’s useful. If you’re not seeing your mount as expected, you need to go back and check your config.

1 Like

Right, the theme config was missing the module…

[module]
[[module.imports]]
path = "github.com/davidsneighbour/dnb-hugo-libs/bootstrap4"

and the paths turn up in the root… :innocent::alien:

Now completely different errors pop up. “But that is a completely different story”.

Thanks @bep.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.