diff --git a/tpl/templates/integration_test.go b/tpl/templates/integration_test.go index fea2d7f6e07..d6ea9228dd2 100644 --- a/tpl/templates/integration_test.go +++ b/tpl/templates/integration_test.go @@ -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 + +`) +} diff --git a/tpl/tplimpl/template_funcs.go b/tpl/tplimpl/template_funcs.go index b8102c75d82..1979fa1c9b0 100644 --- a/tpl/tplimpl/template_funcs.go +++ b/tpl/tplimpl/template_funcs.go @@ -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"