Repository: gohugoio/hugo (language: go)

Issue:
function "page" not defined
hugo v0.111.0-DEV-66f94b4945e804f10be0a04d1365bb3c6e1a4c05+extended linux/amd64 BuildDate=2023-03-01T17:11:44Z

In layouts/_default/single.html

```
{{ page.IsHome  }}
```

> parse failed: template: _default/single.html:4: function "page" not defined

The [integration test](https://github.com/gohugoio/hugo/blob/master/tpl/page/integration_test.go) passes, so I'm not sure what's happening here.



Discussion / hints:
Hmm... That wasn't a bug I expected to get. Oh well, yesterday was a day filed with mysterious error situations, so I shouldn't be surprised.

Fix patch:
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"


Test patch:
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
+
+`)
+}