We have multiple Hugo sites that all use a shared theme, which we’ve created as a module. Our goal is to centralize and manage all common configuration values within this theme module, so that individual sites don’t need to duplicate them.
We are referring: Merge configuration settings
We want common configuration (such as services.googleAnalytics
) to live in the theme module and be automatically merged into each site’s config.
Common theme module (mymodule/
)
mymodule/
└── config/
└── _default/
└── hugo.yaml
Contents of hugo.yaml
in the module:
services:
googleAnalytics:
ID: G-SSSSSSSSS
Consuming site (mysite1/
)
mysite1/
└── config/
└── _default/
└── hugo.yaml
Contents of hugo.yaml
in the site:
_merge: deep
module:
imports:
- path: mymodule
services:
_merge: deep
markup:
_merge: deep
The issue
When we run: hugo config
the services.googleAnalytics.ID
value from the module does not appear in the merged configuration.
We’d appreciate any clarification or guidance. Thanks!