summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--hugolib/page__per_output.go3
-rw-r--r--hugolib/page_test.go22
2 files changed, 25 insertions, 0 deletions
diff --git a/hugolib/page__per_output.go b/hugolib/page__per_output.go
index 65809a377..89dc5ac77 100644
--- a/hugolib/page__per_output.go
+++ b/hugolib/page__per_output.go
@@ -557,6 +557,9 @@ func (p *pageContentOutput) RenderWithTemplateInfo(ctx context.Context, info tpl
}
func (p *pageContentOutput) Render(ctx context.Context, layout ...string) (template.HTML, error) {
+ if len(layout) == 0 {
+ return "", errors.New("no layout given")
+ }
templ, found, err := p.p.resolveTemplate(layout...)
if err != nil {
return "", p.p.wrapError(err)
diff --git a/hugolib/page_test.go b/hugolib/page_test.go
index 162f26052..5237b6340 100644
--- a/hugolib/page_test.go
+++ b/hugolib/page_test.go
@@ -1983,3 +1983,25 @@ title: "p2"
b.Assert(identity.HashString(p1), qt.Not(qt.Equals), identity.HashString(p2))
b.Assert(identity.HashString(sites[0]), qt.Not(qt.Equals), identity.HashString(sites[1]))
}
+
+// Issue #11243
+func TestRenderWithoutArgument(t *testing.T) {
+ t.Parallel()
+
+ files := `
+-- hugo.toml --
+-- layouts/index.html --
+{{ .Render }}
+`
+
+ b, err := NewIntegrationTestBuilder(
+ IntegrationTestConfig{
+ T: t,
+ TxtarString: files,
+ Running: true,
+ },
+ ).BuildE()
+
+ b.Assert(err, qt.IsNotNil)
+
+}