Skip to content

Commit 2983bed

Browse files
committed
Remove WARN with false negatives
Fixes #13806
1 parent 36f6f98 commit 2983bed

File tree

3 files changed

+27
-26
lines changed

3 files changed

+27
-26
lines changed

hugolib/cascade_test.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -938,3 +938,30 @@ path = '/p1'
938938

939939
b.AssertFileContent("public/p1/index.html", "p1|bar") // actual content is "p1|"
940940
}
941+
942+
func TestCascadeWarnOverrideIssue13806(t *testing.T) {
943+
t.Parallel()
944+
945+
files := `
946+
-- hugo.toml --
947+
disableKinds = ['home','rss','section','sitemap','taxonomy','term']
948+
[[cascade]]
949+
[cascade.params]
950+
searchable = true
951+
[cascade.target]
952+
kind = 'page'
953+
-- content/something.md --
954+
---
955+
title: Something
956+
params:
957+
searchable: false
958+
---
959+
-- layouts/all.html --
960+
All.
961+
962+
`
963+
964+
b := Test(t, files, TestOptWarn())
965+
966+
b.AssertLogContains("! WARN")
967+
}

hugolib/page__meta.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import (
2929

3030
"github.com/gohugoio/hugo/source"
3131

32-
"github.com/gohugoio/hugo/common/constants"
3332
"github.com/gohugoio/hugo/common/hashing"
3433
"github.com/gohugoio/hugo/common/hugo"
3534
"github.com/gohugoio/hugo/common/loggers"
@@ -647,9 +646,6 @@ params:
647646
}
648647

649648
for k, v := range userParams {
650-
if _, found := params[k]; found {
651-
p.s.Log.Warnidf(constants.WarnFrontMatterParamsOverrides, "Hugo front matter key %q is overridden in params section.", k)
652-
}
653649
params[strings.ToLower(k)] = v
654650
}
655651

hugolib/params_test.go

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -94,28 +94,6 @@ a/b pages: {{ range $ab.RegularPages }}{{ .Path }}|{{ .RelPermalink }}|{{ end }}
9494
)
9595
}
9696

97-
func TestFrontMatterTitleOverrideWarn(t *testing.T) {
98-
t.Parallel()
99-
100-
files := `
101-
-- hugo.toml --
102-
baseURL = "https://example.org/"
103-
disableKinds = ["taxonomy", "term"]
104-
-- content/p1.md --
105-
---
106-
title: "My title"
107-
params:
108-
title: "My title from params"
109-
---
110-
111-
112-
`
113-
114-
b := Test(t, files, TestOptWarn())
115-
116-
b.AssertLogContains("ARN Hugo front matter key \"title\" is overridden in params section", "You can suppress this warning")
117-
}
118-
11997
func TestFrontMatterParamsLangNoCascade(t *testing.T) {
12098
t.Parallel()
12199

0 commit comments

Comments
 (0)