diff options
Diffstat (limited to 'resources/page')
-rw-r--r-- | resources/page/page_matcher.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/resources/page/page_matcher.go b/resources/page/page_matcher.go index 466b6fe53..f2075273a 100644 --- a/resources/page/page_matcher.go +++ b/resources/page/page_matcher.go @@ -98,6 +98,12 @@ func isGlobWithExtension(s string) bool { return strings.Count(last, ".") > 0 } +func CheckCascadePattern(logger loggers.Logger, m PageMatcher) { + if logger != nil && isGlobWithExtension(m.Path) { + logger.Erroridf("cascade-pattern-with-extension", "cascade target path %q looks like a path with an extension; since Hugo v0.123.0 this will not match anything, see https://gohugo.io/methods/page/path/", m.Path) + } +} + func DecodeCascadeConfig(logger loggers.Logger, 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) @@ -127,9 +133,7 @@ func DecodeCascadeConfig(logger loggers.Logger, in any) (*config.ConfigNamespace for _, cfg := range cfgs { m := cfg.Target - if isGlobWithExtension(m.Path) { - logger.Erroridf("cascade-pattern-with-extension", "cascade target path %q looks like a path with an extension; since Hugo v0.123.0 this will not match anything, see https://gohugo.io/methods/page/path/", m.Path) - } + CheckCascadePattern(logger, m) c, found := cascade[m] if found { // Merge |