{"record":{"id":"327cdfe79dfe94ba","repo":"gohugoio/hugo","slug":"markup-must-not-be-set-use-mediatype","errorCode":null,"errorMessage":"markup must not be set, use mediaType","messagePattern":"markup must not be set, use mediaType","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"resources/page/pagemeta/page_frontmatter.go","lineNumber":241,"sourceCode":"\treturn p.MatchRoleCoarse(siteVector) && p.MatchVersionCoarse(siteVector)\n}\n\nfunc DefaultPageConfig() *PageConfigLate {\n\treturn &PageConfigLate{\n\t\tBuild: DefaultBuildConfig,\n\t}\n}\n\nfunc (p *PageConfigEarly) Init(pagesFromData bool) error {\n\tif pagesFromData {\n\t\tp.Path = strings.TrimPrefix(p.Path, \"/\")\n\n\t\tif p.Path == \"\" && p.Kind != kinds.KindHome {\n\t\t\treturn fmt.Errorf(\"empty path is reserved for the home page\")\n\t\t}\n\n\t\tif p.Content.Markup != \"\" {\n\t\t\treturn errors.New(\"markup must not be set, use mediaType\")\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (p *PageConfigLate) Init() error {\n\treturn nil\n}\n\nfunc buildSitesComplementsFromSitesConfig(\n\tconf config.AllProvider,\n\tfim *hugofs.FileMeta,\n\tsitesConfig sitesmatrix.Sites,\n) sitesmatrix.VectorStore {\n\tif sitesConfig.Complements.IsZero() {\n\t\tif fim != nil && fim.SitesComplements != nil {\n\t\t\treturn fim.SitesComplements","sourceCodeStart":223,"sourceCodeEnd":259,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/resources/page/pagemeta/page_frontmatter.go#L223-L259","documentation":"When pages are created from data via the content adapter API (`pagesFromData`), `PageConfigEarly.Init` forbids setting `content.markup` (page_frontmatter.go:240-242). Content-adapter pages must declare `mediaType` instead, because the markup field is reserved for file-based content and would be ambiguous in the data API.","triggerScenarios":"Calling `.AddPage` (or equivalent content-adapter hook) with a `content.markup` value set, e.g. passing `markup: markdown` when programmatically adding a page.","commonSituations":"Migrating file-based front matter patterns into a content adapter; following an outdated tutorial that used `markup`; assuming `markup` and `mediaType` are interchangeable.","solutions":["Replace `content.markup` with `content.mediaType` (e.g. `text/markdown`) when adding pages from data.","Leave both unset if the default media type is acceptable."],"exampleFix":"{{/* before */}}\n{{ $.AddPage (dict \"kind\" \"page\" \"path\" \"a/b\" \"content\" (dict \"markup\" \"markdown\" \"value\" \"...\")) }}\n\n{{/* after */}}\n{{ $.AddPage (dict \"kind\" \"page\" \"path\" \"a/b\" \"content\" (dict \"mediaType\" \"text/markdown\" \"value\" \"...\")) }}","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["For pages added via the content adapter, set content.mediaType, never content.markup.","Audit AddPage calls when porting file-based front matter to the data API."],"tags":["hugo","content-adapter","configuration","validation"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}