Emit a warning that can be turned off when overwriting built-in .Params values

Fixes #11941
This commit is contained in:
Bjørn Erik Pedersen
2024-01-30 10:07:28 +01:00
parent 4e84f57efb
commit afee781f03
3 changed files with 29 additions and 1 deletions

View File

@@ -133,6 +133,28 @@ RegularPages: {{ range site.RegularPages }}{{ .Path }}|{{ .RelPermalink }}|{{ .T
)
}
func TestFrontMatterTitleOverrideWarn(t *testing.T) {
t.Parallel()
files := `
-- hugo.toml --
baseURL = "https://example.org/"
disableKinds = ["taxonomy", "term"]
-- content/p1.md --
---
title: "My title"
params:
title: "My title from params"
---
`
b := Test(t, files, TestOptWarn())
b.AssertLogContains("ARN Hugo front matter key \"title\" is overridden in params section", "You can suppress this warning")
}
func TestFrontMatterParamsLangNoCascade(t *testing.T) {
t.Parallel()