Return error when .Render is invoked without arg

Fixes #11243
This commit is contained in:
Bjørn Erik Pedersen
2023-07-13 15:01:41 +02:00
parent f1886f8c37
commit 4da672af88
2 changed files with 25 additions and 0 deletions

View File

@@ -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)