mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
parent
f1886f8c37
commit
4da672af88
2 changed files with 25 additions and 0 deletions
|
@ -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) {
|
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...)
|
templ, found, err := p.p.resolveTemplate(layout...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", p.p.wrapError(err)
|
return "", p.p.wrapError(err)
|
||||||
|
|
|
@ -1983,3 +1983,25 @@ title: "p2"
|
||||||
b.Assert(identity.HashString(p1), qt.Not(qt.Equals), identity.HashString(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]))
|
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)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue