Share config via modules

Hello everyone,

I’m facing the following issue and would appreciate your help!

Setup

/home/user/modules/config-global/
└── config/
    └── production/
        ├── hugo.yaml
└── static/
     └── test.txt

Inside hugo.yaml of the module:

disableKinds:
  - section
  - taxonomy
  - term
/home/user/site-playground/
└── config/
    └── _default/
        ├── hugo.yaml
    └── production/

Inside _default/hugo.yaml of site-playground:

baseURL: https://xxxx.com
languageCode: de-DE

module:
  imports:
    - path: "github.com/XXX/XXX-config-global"

The test.txt file from the module is correctly included in the static/ folder.


Problem

I am a Hugo beginner, and no matter what I try, I cannot get hugo.yaml from a module on GitHub into my project.
I have tried:

  • Using production/ or not
  • Using mount
  • Using configDir

However, nothing works.


Goal

I want to manage some static configuration settings across multiple sites and thought that modules would be the best approach.

However, some sources say this is not possible, while others suggest that it should work.
I haven’t found any official documentation or best practices on this.

:bulb: What is the recommended way to handle this? Is there an official solution?

Thanks a lot for your help! :rocket:

You can affect some config settings from a module, but not all, and those you can affect depend on the merge depth as described here:

https://gohugo.io/getting-started/configuration/#merge-configuration-from-themes

Let’s say you write a module, and its configuration contains:

markup.goldmark.renderer.unsafe = true

I certainly don’t want that merged into my configuration. That would be a very bad thing. As would disabling certain page kinds as shown in your example.

1 Like

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