{"record":{"id":"d9cf7018694624b4","repo":"gohugoio/hugo","slug":"front-matter-field-q-must-be-a-map-w","errorCode":null,"errorMessage":"front matter field %q must be a map: %w","messagePattern":"front matter field %q must be a map: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"hugolib/page__meta.go","lineNumber":682,"sourceCode":"params:\n  build: \"My Build\"\n---\n´\n\n`\n\t\t}\n\t\treturn fmt.Errorf(\"failed to decode build config in front matter: %s%s\", err, msgDetail)\n\t}\n\n\tvar draft, published, isCJKLanguage *bool\n\tvar userParams map[string]any\n\tfor k, v := range pcfg.Params {\n\t\tloki := strings.ToLower(k)\n\n\t\tif loki == \"params\" {\n\t\t\tvv, err := hmaps.ToParamsAndPrepare(v)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"front matter field %q must be a map: %w\", k, err)\n\t\t\t}\n\t\t\tuserParams = vv\n\t\t\tdelete(pcfg.Params, k)\n\t\t\tcontinue\n\t\t}\n\n\t\tif loki == \"published\" { // Intentionally undocumented\n\t\t\tvv, err := cast.ToBoolE(v)\n\t\t\tif err == nil {\n\t\t\t\tpublished = &vv\n\t\t\t}\n\t\t\t// published may also be a date\n\t\t\tcontinue\n\t\t}\n\n\t\tif ps.s.frontmatterHandler.IsDateKey(loki) {\n\t\t\tcontinue\n\t\t}","sourceCodeStart":664,"sourceCodeEnd":700,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/hugolib/page__meta.go#L664-L700","documentation":"From the front-matter params decoder (page__meta.go:682). The `params` front-matter key must decode to a map[string]any via hmaps.ToParamsAndPrepare; if it is a scalar, list, or otherwise not a map, that call errors and Hugo surfaces it with the offending key name.","triggerScenarios":"Front matter writes `params:` as a scalar (`params: foo`) or a sequence (`params: [a, b]`) instead of a keyed map. The decoder rejects anything it cannot represent as params.","commonSituations":"Copying a snippet that uses an array under params; YAML indentation making params a string; TOML table misuse.","solutions":["Make `params` a keyed map: `params:\\n  key: value` (YAML) or `[params]\\nkey = \"value\"` (TOML).","Verify indentation so params parses as a map, not a scalar/list.","Move array values under named keys if you need collections inside params."],"exampleFix":"// before\n---\nparams: [foo, bar]\n---\n\n// after\n---\nparams:\n  tags:\n    - foo\n    - bar\n---","handlingStrategy":"validation","validationCode":"# params front matter must be a map; check before commit\n# YAML: ensure `params:` is followed by indented keys, never a scalar/list","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always make `params` a keyed map.","Use a front-matter linter in CI to reject scalar/array params.","Indent YAML so params parses as a map."],"tags":["front-matter","params","config","decode"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}