Skip to content

Commit

Permalink
resource/page: Slight adjustment of Page.Ancestors
Browse files Browse the repository at this point in the history
Fixes #10567
  • Loading branch information
bep committed Dec 23, 2022
1 parent 3a21618 commit eb0c8f9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions hugolib/page__tree.go
Expand Up @@ -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 {
Expand Down

0 comments on commit eb0c8f9

Please sign in to comment.