Fix "page" not defined

Fixes #10774
This commit is contained in:
Bjørn Erik Pedersen 2023-03-02 09:37:07 +01:00
parent 66f94b4945
commit eef23a7f27
2 changed files with 27 additions and 0 deletions

View 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
`)
}

View 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"