mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-17 21:01:26 +02:00
Emit a warning that can be turned off when overwriting built-in .Params values
Fixes #11941
This commit is contained in:
@@ -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()
|
||||
|
||||
|
Reference in New Issue
Block a user