resource/page: Slight adjustment of Page.Ancestors

Fixes #10567
This commit is contained in:
Bjørn Erik Pedersen 2022-12-23 09:13:19 +01:00
parent 3a216186b2
commit eb0c8f9d02

View file

@ -178,13 +178,14 @@ func (pt pageTree) Parent() page.Page {
return b.p
}
func (pt pageTree) Ancestors() (parents page.Pages) {
func (pt pageTree) Ancestors() page.Pages {
var ancestors page.Pages
parent := pt.Parent()
for parent != nil {
parents = append(parents, parent)
ancestors = append(ancestors, parent)
parent = parent.Parent()
}
return
return ancestors
}
func (pt pageTree) Sections() page.Pages {