summaryrefslogtreecommitdiffstats
path: root/hugolib/page__tree.go
diff options
context:
space:
mode:
authorTakayama Fumihiko <tekezo@pqrs.org>2020-04-24 01:23:32 +0900
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-04-23 20:23:42 +0200
commit8d5766d417d6564a1aa1cbe8f9a29ab9bba22371 (patch)
treec8b5bdc2f177dfeb1cfa738b622edc333081adea /hugolib/page__tree.go
parent5c41f41ad4b14e48aea64687a7600f5ad231e879 (diff)
downloadhugo-8d5766d417d6564a1aa1cbe8f9a29ab9bba22371.tar.gz
hugo-8d5766d417d6564a1aa1cbe8f9a29ab9bba22371.zip
Fix IsAncestor and IsDescendant when the same page is passed
Diffstat (limited to 'hugolib/page__tree.go')
-rw-r--r--hugolib/page__tree.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/hugolib/page__tree.go b/hugolib/page__tree.go
index bb28f1181..a6f66ffbc 100644
--- a/hugolib/page__tree.go
+++ b/hugolib/page__tree.go
@@ -54,6 +54,10 @@ func (pt pageTree) IsAncestor(other interface{}) (bool, error) {
return false, nil
}
+ if ref1.key == ref2.key {
+ return true, nil
+ }
+
if strings.HasPrefix(ref2.key, ref1.key+"/") {
return true, nil
}
@@ -101,6 +105,10 @@ func (pt pageTree) IsDescendant(other interface{}) (bool, error) {
return false, nil
}
+ if ref1.key == ref2.key {
+ return true, nil
+ }
+
if strings.HasPrefix(ref1.key, ref2.key+"/") {
return true, nil
}