diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2023-03-02 09:37:07 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2023-03-02 10:39:44 +0100 |
commit | eef23a7f2762ac2875da14a432f4700c43d58deb (patch) | |
tree | 2a5a6b77b93e5527d3b1b4a9b6be491b33697201 /tpl | |
parent | 66f94b4945e804f10be0a04d1365bb3c6e1a4c05 (diff) |
Fix "page" not defined
Fixes #10774
Diffstat (limited to 'tpl')
-rw-r--r-- | tpl/templates/integration_test.go | 26 | ||||
-rw-r--r-- | tpl/tplimpl/template_funcs.go | 1 |
2 files changed, 27 insertions, 0 deletions
diff --git a/tpl/templates/integration_test.go b/tpl/templates/integration_test.go index fea2d7f6e..d6ea9228d 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 b8102c75d..1979fa1c9 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" |