Skip to content

Commit

Permalink
Fix "page" not defined
Browse files Browse the repository at this point in the history
Fixes #10774
  • Loading branch information
bep committed Mar 2, 2023
1 parent 66f94b4 commit eef23a7
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tpl/templates/integration_test.go
Expand Up @@ -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
`)
}
1 change: 1 addition & 0 deletions tpl/tplimpl/template_funcs.go
Expand Up @@ -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"
Expand Down

0 comments on commit eef23a7

Please sign in to comment.