aboutsummaryrefslogtreecommitdiffhomepage
path: root/hugolib/params_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2024-02-03 12:08:00 +0100
committerBjørn Erik Pedersen <[email protected]>2024-02-03 15:07:59 +0100
commita66480f70c1ac734ba5af035e626d29ffcde157d (patch)
treee14fdf9a405e5d92ce6e78633a87569a7d979472 /hugolib/params_test.go
parente33a63255187bb4c5323e107b727e1d7b0117d19 (diff)
downloadhugo-a66480f70c1ac734ba5af035e626d29ffcde157d.tar.gz
hugo-a66480f70c1ac734ba5af035e626d29ffcde157d.zip
Handle build vs _build in front matter
* Throw a detailed error message in the mentioned case * Also fixed a dropped error Fixes #11970
Diffstat (limited to 'hugolib/params_test.go')
-rw-r--r--hugolib/params_test.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/hugolib/params_test.go b/hugolib/params_test.go
index 6f890b43b..cbcc8e540 100644
--- a/hugolib/params_test.go
+++ b/hugolib/params_test.go
@@ -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")
+}