mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-31 22:41:53 +02:00
Add path, kind and lang to content front matter
Note that none of these can be set via cascade (you will get an error) Fixes #11544
This commit is contained in:
@@ -82,6 +82,14 @@ func (m PageMatcher) Matches(p Page) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
var disallowedCascadeKeys = map[string]bool{
|
||||
// These define the structure of the page tree and cannot
|
||||
// currently be set in the cascade.
|
||||
"kind": true,
|
||||
"path": true,
|
||||
"lang": true,
|
||||
}
|
||||
|
||||
func DecodeCascadeConfig(in any) (*config.ConfigNamespace[[]PageMatcherParamsConfig, map[PageMatcher]maps.Params], error) {
|
||||
buildConfig := func(in any) (map[PageMatcher]maps.Params, any, error) {
|
||||
cascade := make(map[PageMatcher]maps.Params)
|
||||
@@ -101,6 +109,11 @@ func DecodeCascadeConfig(in any) (*config.ConfigNamespace[[]PageMatcherParamsCon
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
for k := range m {
|
||||
if disallowedCascadeKeys[k] {
|
||||
return nil, nil, fmt.Errorf("key %q not allowed in cascade config", k)
|
||||
}
|
||||
}
|
||||
cfgs = append(cfgs, c)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user