mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-31 22:41:53 +02:00
Fix IsAncestor and IsDescendant under subsection
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
ade27699e5
commit
27a4c4410c
@@ -54,8 +54,8 @@ func (pt pageTree) IsAncestor(other interface{}) (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
if ref2.isSection() {
|
||||
return strings.HasPrefix(ref2.key, ref1.key+"/"), nil
|
||||
if strings.HasPrefix(ref2.key, ref1.key+"/") {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
return strings.HasPrefix(ref2.key, ref1.key+cmBranchSeparator), nil
|
||||
@@ -101,8 +101,8 @@ func (pt pageTree) IsDescendant(other interface{}) (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
if ref1.isSection() {
|
||||
return strings.HasPrefix(ref1.key, ref2.key+"/"), nil
|
||||
if strings.HasPrefix(ref1.key, ref2.key+"/") {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
return strings.HasPrefix(ref1.key, ref2.key+cmBranchSeparator), nil
|
||||
|
Reference in New Issue
Block a user