Fix "page" not defined - hugo - [fork] hugo port for 9front
HTML git clone git@git.drkhsh.at/hugo.git
DIR Log
DIR Files
DIR Refs
DIR Submodules
DIR README
DIR LICENSE
---
DIR commit eef23a7f2762ac2875da14a432f4700c43d58deb
DIR parent 66f94b4945e804f10be0a04d1365bb3c6e1a4c05
HTML Author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Date: Thu, 2 Mar 2023 09:37:07 +0100
Fix "page" not defined
Fixes #10774
Diffstat:
M tpl/templates/integration_test.go | 26 ++++++++++++++++++++++++++
M tpl/tplimpl/template_funcs.go | 1 +
2 files changed, 27 insertions(+), 0 deletions(-)
---
DIR diff --git 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
+
+`)
+}
DIR diff --git 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"