mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-21 01:43:48 +00:00
parent
6be6684cc5
commit
4c2a0de412
2 changed files with 9 additions and 4 deletions
|
@ -21,13 +21,16 @@ func Test404(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
b := newTestSitesBuilder(t)
|
b := newTestSitesBuilder(t)
|
||||||
b.WithSimpleConfigFile().WithTemplatesAdded("404.html", "<html><body>Not Found!</body></html>")
|
b.WithSimpleConfigFile().WithTemplatesAdded("404.html", "<html><body>Not Found! Parent: {{ .Parent.Kind }}</body></html>")
|
||||||
b.Build(BuildCfg{})
|
b.Build(BuildCfg{})
|
||||||
|
|
||||||
// Note: We currently have only 1 404 page. One might think that we should have
|
// Note: We currently have only 1 404 page. One might think that we should have
|
||||||
// multiple, to follow the Custom Output scheme, but I don't see how that would work
|
// multiple, to follow the Custom Output scheme, but I don't see how that would work
|
||||||
// right now.
|
// right now.
|
||||||
b.AssertFileContent("public/404.html", "Not Found")
|
b.AssertFileContent("public/404.html", `
|
||||||
|
Not Found
|
||||||
|
Parent: home
|
||||||
|
`)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -121,11 +121,13 @@ func (pt pageTree) Parent() page.Page {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if pt.p.Kind() == page.KindTaxonomyTerm {
|
tree := p.getTreeRef()
|
||||||
|
|
||||||
|
if pt.p.Kind() == page.KindTaxonomyTerm || tree == nil {
|
||||||
return pt.p.s.home
|
return pt.p.s.home
|
||||||
}
|
}
|
||||||
|
|
||||||
_, b := p.getTreeRef().getSection()
|
_, b := tree.getSection()
|
||||||
if b == nil {
|
if b == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue