]> git.maquefel.me Git - brevno-suite/hugo/commitdiff
Fix "page" not defined
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Thu, 2 Mar 2023 08:37:07 +0000 (09:37 +0100)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Thu, 2 Mar 2023 09:39:44 +0000 (10:39 +0100)
Fixes #10774

tpl/templates/integration_test.go
tpl/tplimpl/template_funcs.go

index fea2d7f6e073b0a2e500cf3c5a409cefa4b60001..d6ea9228dd25e1b15cc79912e76df0daa514d0e7 100644 (file)
@@ -83,3 +83,29 @@ post/doesnotexist.html: false
 
 `)
 }
+
+
+// See #10774
+func TestPageFunctionExists(t *testing.T) {
+       t.Parallel()
+
+       files := `
+-- config.toml --
+baseURL = 'http://example.com/'
+-- layouts/index.html --
+Home: {{ page.IsHome }}
+
+`
+
+       b := hugolib.NewIntegrationTestBuilder(
+               hugolib.IntegrationTestConfig{
+                       T:           t,
+                       TxtarString: files,
+               },
+       ).Build()
+
+       b.AssertFileContent("public/index.html", `
+Home: true
+
+`)
+}
index b8102c75d82b5200a3ce0d831201e5f82fad44c1..1979fa1c9b07b6236b2bfc66073fd0b218509ca8 100644 (file)
@@ -50,6 +50,7 @@ import (
        _ "github.com/gohugoio/hugo/tpl/math"
        _ "github.com/gohugoio/hugo/tpl/openapi/openapi3"
        _ "github.com/gohugoio/hugo/tpl/os"
+       _ "github.com/gohugoio/hugo/tpl/page"
        _ "github.com/gohugoio/hugo/tpl/partials"
        _ "github.com/gohugoio/hugo/tpl/path"
        _ "github.com/gohugoio/hugo/tpl/reflect"