HUGO

Hugo Modules `ignoreConfig` does not prevent imports

I’m giving a spin to Hugo Modules and very excited about it. One think I don’t understand is how to import a module without its own dependency.

I set up a basic parent project and init it as Hugo Module :point_right: https://github.com/theNewDynamic/hugo-modules-test with the following module config:

module:
  imports:
    - path: github.com/regisphilibert/mod-content-test
      ignoreConfig: true
      mounts:
      - source: content/test
        target: content/note

Then set up a simple “content” repo :point_right: https://github.com/regisphilibert/mod-content-test with the following module config:

module:
  imports:
    - path: github.com/regisphilibert/rp_hugo

By setting ignoreConfig: true on the parent when “importing” the “content only” module, I would think Hugo would not import the “content module”'s own imports. Yet it does.

I’m not sure how to make sure how the “import tree” stops and the “content” module.

You could add a replace directive in go.mod that points to an empty folder.

ignoreConfig means “ignore any meny, params etc.” setting. The dependencies/imports are assumed to be needed to build the theme component.

As I see it, it will be tempting for a lot of people to have their editor access a “content only repo” which imports a “code repo”. And dev will maintain that “code repo” importing the “content only repo”.

This is an appealing setup and use case which I think we should try and make possible by avoiding any recursive imports problems. Maybe adding a module setting which ignores its imports. ignoreImports ?

1 Like