Handle build vs _build in front matter

* Throw a detailed error message in the mentioned case
* Also fixed a dropped error

Fixes #11970
This commit is contained in:
Bjørn Erik Pedersen
2024-02-03 12:08:00 +01:00
parent e33a632551
commit a66480f70c
3 changed files with 46 additions and 5 deletions

View File

@@ -181,3 +181,24 @@ lang = 'nn'
b, err := TestE(t, files)
b.Assert(err, qt.IsNotNil)
}
// Issue 11970.
func TestFrontMatterBuildIsHugoKeyword(t *testing.T) {
t.Parallel()
files := `
-- hugo.toml --
baseURL = "https://example.org/"
-- content/p1.md --
---
title: "P1"
build: "foo"
---
-- layouts/_default/single.html --
Params: {{ range $k, $v := .Params }}{{ $k }}: {{ $v }}|{{ end }}$
`
b, err := TestE(t, files)
b.Assert(err, qt.IsNotNil)
b.Assert(err.Error(), qt.Contains, "We renamed the _build keyword")
}