Make cascade front matter order deterministic

Fixes #12594
This commit is contained in:
Bjørn Erik Pedersen
2025-01-22 17:47:54 +01:00
parent 77a8e347bc
commit 7f0f50b133
10 changed files with 318 additions and 48 deletions

View File

@@ -841,3 +841,38 @@ title: p1
b.AssertFileExists("public/s1/index.html", false)
b.AssertFileExists("public/s1/p1/index.html", false)
}
// Issue 12594.
func TestCascadeOrder(t *testing.T) {
t.Parallel()
files := `
-- hugo.toml --
disableKinds = ['rss','sitemap','taxonomy','term', 'home']
-- content/_index.md --
---
title: Home
cascade:
- _target:
path: "**"
params:
background: yosemite.jpg
- _target:
params:
background: goldenbridge.jpg
---
-- content/p1.md --
---
title: p1
---
-- layouts/_default/single.html --
Background: {{ .Params.background }}|
-- layouts/_default/list.html --
{{ .Title }}|
`
for i := 0; i < 10; i++ {
b := Test(t, files)
b.AssertFileContent("public/p1/index.html", "Background: yosemite.jpg")
}
}