{"id":"c75c9f5cc48d4744","repo":"gohugoio/hugo","slug":"q-did-not-match-a-valid-page-kind","errorCode":null,"errorMessage":"%q did not match a valid Page Kind","messagePattern":"%q did not match a valid Page Kind","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"resources/page/page_matcher.go","lineNumber":244,"sourceCode":"\t\tdefault:\n\t\t\tpcfg.Fields[k] = v\n\t\t}\n\t}\n\treturn pcfg, pcfg.init()\n}\n\n// decodePageMatcher decodes m into v.\nfunc (d cascadeConfigDecoder) decodePageMatcher(m any, v *PageMatcher) error {\n\tif err := mapstructure.WeakDecode(m, v); err != nil {\n\t\treturn err\n\t}\n\n\tv.Kind = strings.ToLower(v.Kind)\n\tif v.Kind != \"\" {\n\t\tg, _ := hglob.GetGlob(v.Kind)\n\t\tfound := slices.ContainsFunc(kinds.AllKindsInPages, g.Match)\n\t\tif !found {\n\t\t\treturn fmt.Errorf(\"%q did not match a valid Page Kind\", v.Kind)\n\t\t}\n\t}\n\n\tv.Path = filepath.ToSlash(strings.ToLower(v.Path))\n\n\tif v.Lang != \"\" {\n\t\tv.Sites.Matrix.Languages = append(v.Sites.Matrix.Languages, v.Lang)\n\t\tv.Sites.Matrix.Languages = hstrings.UniqueStringsReuse(v.Sites.Matrix.Languages)\n\t}\n\n\treturn nil\n}\n\nfunc (v *PageMatcher) compileGlobs() error {\n\tvar err error\n\tif v.Kind != \"\" {\n\t\tv.kindGlob, err = hglob.GetGlob(v.Kind)\n\t\tif err != nil {","sourceCodeStart":226,"sourceCodeEnd":262,"githubUrl":"https://github.com/gohugoio/hugo/blob/8a468df065a75c1c7cf9f6850f32148746590ea5/resources/page/page_matcher.go#L226-L262","documentation":"`decodePageMatcher` lowercases the `kind` given in a cascade `_target` (or other page matcher) and treats it as a glob, then checks it against `kinds.AllKindsInPages`. If no in-page kind matches the glob, Hugo returns this error. It guards against silently-inert cascades that would never apply because the kind name is wrong.","triggerScenarios":"A `_target: {kind: ...}` naming something that isn't a page kind — e.g. `single`, `list`, `sitemap`, `robotsTXT`, `posts`, or a typo like `sectoin`; also fires for a glob such as `t*rm` that happens to match nothing in `AllKindsInPages`.","commonSituations":"Confusing layout template names (`single`, `list`) with page kinds (`page`, `section`, `taxonomy`, `term`, `home`); using pre-0.73 kind names such as `taxonomyTerm`, which was renamed to `term` while the old `taxonomy` semantics shifted; assuming output-format kinds like `sitemap` are matchable.","solutions":["Use a valid page kind: `page`, `home`, `section`, `taxonomy`, or `term`. Kind matching is case-insensitive.","If you migrated from Hugo < 0.73, replace `taxonomyTerm` with `term` and re-check any `taxonomy` targets — the meanings swapped.","Don't use layout names (`single`, `list`) as kinds; those belong in layout lookups, not page matchers.","Glob syntax is supported, so `{taxonomy,term}` targets both — verify your glob actually matches by building and checking the cascade takes effect."],"exampleFix":"# before\ncascade:\n  - _target:\n      kind: single\n    banner: hero.jpg\n\n# after\ncascade:\n  - _target:\n      kind: page\n    banner: hero.jpg","handlingStrategy":"validation","validationCode":"// check kind against the valid set before configuring a matcher\nvalidKinds := map[string]bool{\"home\": true, \"page\": true, \"section\": true, \"taxonomy\": true, \"term\": true}\nif kind != \"\" && !validKinds[strings.ToLower(kind)] {\n    return fmt.Errorf(\"invalid page kind %q\", kind)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use only valid Page Kinds: home, page, section, taxonomy, term","Note glob patterns are allowed (e.g. {section,term}) but each expansion must be a real kind","Don't use legacy/renamed kinds like taxonomyTerm from older Hugo versions"],"tags":["hugo","cascade","page-kind","page-matcher","config"],"analyzedSha":"8a468df065a75c1c7cf9f6850f32148746590ea5","analyzedAt":"2026-07-31T21:23:07.045Z","schemaVersion":2}