mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-17 21:01:26 +02:00
@@ -938,3 +938,30 @@ path = '/p1'
|
|||||||
|
|
||||||
b.AssertFileContent("public/p1/index.html", "p1|bar") // actual content is "p1|"
|
b.AssertFileContent("public/p1/index.html", "p1|bar") // actual content is "p1|"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestCascadeWarnOverrideIssue13806(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
files := `
|
||||||
|
-- hugo.toml --
|
||||||
|
disableKinds = ['home','rss','section','sitemap','taxonomy','term']
|
||||||
|
[[cascade]]
|
||||||
|
[cascade.params]
|
||||||
|
searchable = true
|
||||||
|
[cascade.target]
|
||||||
|
kind = 'page'
|
||||||
|
-- content/something.md --
|
||||||
|
---
|
||||||
|
title: Something
|
||||||
|
params:
|
||||||
|
searchable: false
|
||||||
|
---
|
||||||
|
-- layouts/all.html --
|
||||||
|
All.
|
||||||
|
|
||||||
|
`
|
||||||
|
|
||||||
|
b := Test(t, files, TestOptWarn())
|
||||||
|
|
||||||
|
b.AssertLogContains("! WARN")
|
||||||
|
}
|
||||||
|
@@ -29,7 +29,6 @@ import (
|
|||||||
|
|
||||||
"github.com/gohugoio/hugo/source"
|
"github.com/gohugoio/hugo/source"
|
||||||
|
|
||||||
"github.com/gohugoio/hugo/common/constants"
|
|
||||||
"github.com/gohugoio/hugo/common/hashing"
|
"github.com/gohugoio/hugo/common/hashing"
|
||||||
"github.com/gohugoio/hugo/common/hugo"
|
"github.com/gohugoio/hugo/common/hugo"
|
||||||
"github.com/gohugoio/hugo/common/loggers"
|
"github.com/gohugoio/hugo/common/loggers"
|
||||||
@@ -647,9 +646,6 @@ params:
|
|||||||
}
|
}
|
||||||
|
|
||||||
for k, v := range userParams {
|
for k, v := range userParams {
|
||||||
if _, found := params[k]; found {
|
|
||||||
p.s.Log.Warnidf(constants.WarnFrontMatterParamsOverrides, "Hugo front matter key %q is overridden in params section.", k)
|
|
||||||
}
|
|
||||||
params[strings.ToLower(k)] = v
|
params[strings.ToLower(k)] = v
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -94,28 +94,6 @@ a/b pages: {{ range $ab.RegularPages }}{{ .Path }}|{{ .RelPermalink }}|{{ end }}
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
func TestFrontMatterParamsLangNoCascade(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user