aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2022-12-23 09:13:19 +0100
committerBjørn Erik Pedersen <[email protected]>2022-12-23 10:14:53 +0100
commiteb0c8f9d02431aa0c2bce6f2e5fe27a4e33bf4df (patch)
tree2ad9320505311ee441fa4a4addd8005202533af4
parent3a216186b2cfa479c250dabb64eff022a388fb40 (diff)
downloadhugo-eb0c8f9d02431aa0c2bce6f2e5fe27a4e33bf4df.tar.gz
hugo-eb0c8f9d02431aa0c2bce6f2e5fe27a4e33bf4df.zip
resource/page: Slight adjustment of Page.Ancestors
Fixes #10567
-rw-r--r--hugolib/page__tree.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/hugolib/page__tree.go b/hugolib/page__tree.go
index 6acd649fd..2f9fd2e46 100644
--- a/hugolib/page__tree.go
+++ b/hugolib/page__tree.go
@@ -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 {