I host a template project based on the Docsy theme called “mostlydocs” - It uses cascade at the top level _index.md to apply a default “docs” type to all sections in the site, except for “blog” (or any other sections the user wishes):
cascade:
- _target:
path: "/blog/**"
type: "blog"
- _target:
path: "/**"
type: "docs"
This works great, except it will then also apply that type to all kinds of pages, including taxonomies (so things like /tags/foo
are rendered with the wrong template).
Of course, i could add specific path targets to override those, but that would have to happen for every taxonomy (one more thing for the user of the template to remember to change should they define their own taxonomies).
Instead, it would be simpler if I could use a glob to specify exactly which kinds of pages i wish the cascade to apply to:
cascade:
- _target:
path: "/blog/**"
type: "blog"
- _target:
path: "/**"
kind: "{page,section}"
type: "docs"
PR 7784 introduced exactly this, by allowing “kind” to match a glob rather than a string, but DecodePageMatcher seems at odds with the Matches implementation by enforcing a check to see if the supplied “kind” actually maps to a known kind.
The glob documentation was reverted, it appears in this commit, i imagine to match actual behaviour.
This leads to two questions:
- Is there a better way of solving my issue that doesn’t require glob kind matching at all
- Glob kind matching is still in the hugo source code; should DecodePageMatcher just be updated to remove that map test so it can actually be used (i tried removing it locally and it worked great)