mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-29 22:29:56 +02:00
Fix IsAncestor and IsDescendant when the same page is passed
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
5c41f41ad4
commit
8d5766d417
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user