{"record":{"id":"75ece28e99cd12b6","repo":"gohugoio/hugo","slug":"failed-to-decode-sitemap-config-in-front-matter","errorCode":null,"errorMessage":"failed to decode sitemap config in front matter: %s","messagePattern":"failed to decode sitemap config in front matter: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"hugolib/page__meta.go","lineNumber":770,"sourceCode":"\t\tcase \"layout\":\n\t\t\tpcfg.Layout = cast.ToString(v)\n\t\t\tpcfg.Params[loki] = pcfg.Layout\n\t\tcase \"weight\":\n\t\t\tpcfg.Weight = cast.ToInt(v)\n\t\t\tpcfg.Params[loki] = pcfg.Weight\n\t\tcase \"aliases\":\n\t\t\tpcfg.Aliases = cast.ToStringSlice(v)\n\t\t\tfor i, alias := range pcfg.Aliases {\n\t\t\t\tif strings.HasPrefix(alias, \"http://\") || strings.HasPrefix(alias, \"https://\") {\n\t\t\t\t\treturn fmt.Errorf(\"http* aliases not supported: %q\", alias)\n\t\t\t\t}\n\t\t\t\tpcfg.Aliases[i] = filepath.ToSlash(alias)\n\t\t\t}\n\t\t\tpcfg.Params[loki] = pcfg.Aliases\n\t\tcase \"sitemap\":\n\t\t\tpcfg.Sitemap, err = config.DecodeSitemap(ps.s.conf.Sitemap, hmaps.ToStringMap(v))\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to decode sitemap config in front matter: %s\", err)\n\t\t\t}\n\t\t\tsitemapSet = true\n\t\tcase \"iscjklanguage\":\n\t\t\tisCJKLanguage = new(bool)\n\t\t\t*isCJKLanguage = cast.ToBool(v)\n\t\tcase \"translationkey\":\n\t\t\tpcfg.TranslationKey = cast.ToString(v)\n\t\t\tpcfg.Params[loki] = pcfg.TranslationKey\n\t\tcase \"resources\":\n\t\t\tvar resources []map[string]any\n\t\t\thandled := true\n\n\t\t\tswitch vv := v.(type) {\n\t\t\tcase []map[any]any:\n\t\t\t\tfor _, vvv := range vv {\n\t\t\t\t\tresources = append(resources, hmaps.ToStringMap(vvv))\n\t\t\t\t}\n\t\t\tcase []map[string]any:","sourceCodeStart":752,"sourceCodeEnd":788,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/hugolib/page__meta.go#L752-L788","documentation":"From the `sitemap` front-matter case (page__meta.go:770). config.DecodeSitemap merges the page's sitemap front-matter into the site default; if the value cannot be decoded (wrong types for changeFreq/priority/filename, or not a map), it errors and Hugo wraps it.","triggerScenarios":"Front matter sets `sitemap:` to a scalar or gives known fields wrong types — e.g. `priority: high` (must be float), `changefreq: 5` (must be string), or `sitemap: true`. DecodeSitemap then fails.","commonSituations":"Copying sitemap examples with wrong types; YAML producing a string where a number is expected; treating sitemap as a boolean toggle.","solutions":["Make `sitemap` a map with valid fields: changeFreq (string), priority (float 0–1), filename (string).","Use numeric literals for priority: `priority: 0.7`, not `priority: \"0.7\"` or words.","Drop the sitemap key if you only want site defaults."],"exampleFix":"// before\n---\nsitemap: true\npriority: high\n---\n\n// after\n---\nsitemap:\n  changefreq: monthly\n  priority: 0.7\n  filename: sitemap.xml\n---","handlingStrategy":"validation","validationCode":"{{/* sitemap front matter must be a map with typed fields */}}\n{{/* changeFreq: string, priority: float 0-1, filename: string */}}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Make `sitemap` front matter a map; use numeric priority, string changeFreq.","Don't set sitemap to a boolean or scalar.","Omit the key to inherit site defaults."],"tags":["front-matter","sitemap","config","decode"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}