Problem
Currently, when cascade sets nested parameters—such as a theme’s nested parameter namespace—Hugo performs a shallow check at the top-level key and skips the entire cascade entry if that top-level key already exists in a descendant’s front matter.
For example, in a section _index.md:
[cascade.params.mytheme.shell]
disable_breadcrumbs = false
If a descendant page already defines an unrelated parameter under the same mytheme namespace:
[mytheme.article.headings]
largest_level = 3
Hugo sees that mytheme is already present on the descendant and skips [cascade.params.mytheme.shell] completely, so mytheme.shell.disable_breadcrumbs is never applied. In sites or documentation sections where many pages configure different sub-keys under a shared top-level table, cascade cannot be used to set a single nested default without duplicating it across every page that touches the same top-level key.
Prior Discussions & Why Existing Workarounds Fall Short
This shallow-merge behavior has been raised previously in gohugoio/hugo (such as Issue #8050 and Issue #15334) and on Discourse. The commonly suggested workarounds don’t fit well for themes or structured configs:
- Flattening parameter names (e.g.
mytheme_shell_disable_breadcrumbs) breaks structured, namespaced theme schemas. - Manual
mergein templates requires custom template logic to walk ancestor sections instead of relying on standardPage.Paramlookups and Hugo’s built-incascademechanism. - Duplicating the parameter on every leaf page defeats the purpose of
cascadewhen dozens or hundreds of pages already define other keys under the same top-level table.
Precedent in Hugo
Hugo already solves an analogous problem for site and module configuration files via _merge ("none", "shallow", "deep"), where "deep" recursively merges nested maps instead of stopping at the top-level key. However, front matter cascade currently has no equivalent setting to opt into deep/leaf-level conflict resolution.
Proposal
Add a merge option to cascade to control how conflicts with a target page’s existing front matter are resolved:
"shallow"(default): Preserve current behavior; skip cascading if the top-level key already exists on the target page."deep": Deep-merge nested maps and only skip a leaf field if that exact nested field is already present on the target page.
Example
With merge = "deep":
[[cascade]]
merge = "deep"
[cascade.params.mytheme.shell]
disable_breadcrumbs = false
Given a descendant page with:
[mytheme.article.headings]
largest_level = 3
The resulting page params would be:
[mytheme.article.headings]
largest_level = 3
[mytheme.shell]
disable_breadcrumbs = false
While a descendant page that explicitly sets disable_breadcrumbs = true under [mytheme.shell] would still keep true, because the leaf field conflicts with an already-present value.
Backwards Compatibility
Defaulting to the existing shallow behavior ensures zero breaking changes for existing sites, while opting into merge = "deep" unlocks nested cascade defaults for themes and multi-level parameter structures—consistent with how _merge = "deep" already works for site configuration.