mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-17 21:01:26 +02:00
Deprecate kind, lang, and path from front matter
These were added to the page meta object when we implemented "pages from data", but were not meant to be used in front matter. That is not supported, so we might as well add validation. Fixes #12484
This commit is contained in:
@@ -1942,3 +1942,29 @@ Hugo: h-Home|
|
||||
`,
|
||||
)
|
||||
}
|
||||
|
||||
// See #12484
|
||||
func TestPageFrontMatterDeprecatePathKindLang(t *testing.T) {
|
||||
// This cannot be parallel as it depends on output from the global logger.
|
||||
|
||||
files := `
|
||||
-- hugo.toml --
|
||||
disableKinds = ["taxonomy", "term", "home", "section"]
|
||||
-- content/p1.md --
|
||||
---
|
||||
title: "p1"
|
||||
kind: "page"
|
||||
lang: "en"
|
||||
path: "mypath"
|
||||
---
|
||||
-- layouts/_default/single.html --
|
||||
Title: {{ .Title }}
|
||||
`
|
||||
b := Test(t, files, TestOptWarn())
|
||||
b.AssertFileContent("public/mypath/index.html", "p1")
|
||||
b.AssertLogContains(
|
||||
"deprecated: kind in front matter was deprecated",
|
||||
"deprecated: lang in front matter was deprecated",
|
||||
"deprecated: path in front matter was deprecated",
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user