{"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/8a468df065a75c1c7cf9f6850f32148746590ea5/resources/page/pagemeta/page_frontmatter.go#L223-L259","documentation":"Pages created from data via content adapters must not set the legacy `markup` field; Hugo requires the content format to be expressed as a media type instead (content.mediaType). PageConfigEarly.Init enforces this so the data-driven page API stays on the newer, unambiguous mediaType mechanism rather than the file-extension-era markup identifiers.","triggerScenarios":"A content adapter calling .AddPage with a dict containing content.markup, e.g. (dict \"content\" (dict \"markup\" \"md\" \"value\" $body)) — only for pagesFromData; regular file front matter may still use markup.","commonSituations":"Porting examples or front matter conventions from file-based content (where `markup: md` is valid) into _content.gotmpl adapters; older blog posts/tutorials predating the mediaType requirement.","solutions":["Replace content.markup with content.mediaType in the AddPage dict, e.g. \"mediaType\" \"text/markdown\".","For HTML content use \"mediaType\" \"text/html\"; consult the media types config for other formats."],"exampleFix":"{{/* before */}}\n{{ .AddPage (dict \"path\" \"p1\" \"content\" (dict \"markup\" \"md\" \"value\" $body)) }}\n{{/* after */}}\n{{ .AddPage (dict \"path\" \"p1\" \"content\" (dict \"mediaType\" \"text/markdown\" \"value\" $body)) }}","handlingStrategy":"validation","validationCode":"# in content adapter / front matter with explicit content:\ncontent:\n  mediaType: \"text/markdown\"   # use mediaType, NOT markup","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When supplying `content` with a media type (content adapters), set `mediaType`, not `markup`","Reserve `markup` for regular page front matter without an explicit content block","Follow the current content-adapter docs; the two keys are mutually exclusive here"],"tags":["content-adapter","configuration","media-type","hugo"],"analyzedSha":"8a468df065a75c1c7cf9f6850f32148746590ea5","analyzedAt":"2026-07-31T21:23:07.045Z","schemaVersion":2}