Allow page.HasMenuCurrent() and node.HasMenuCurrent() to proceed with multi-level nested menus

Currently HasMenuCurrent only process the first 2 levels.
This commit is contained in:
Valere JEANTET 2015-06-25 12:26:48 +02:00 committed by Bjørn Erik Pedersen
parent 354192d2b8
commit 247574976c
2 changed files with 8 additions and 1 deletions

View file

@ -14,10 +14,11 @@
package hugolib
import (
"github.com/spf13/hugo/helpers"
"html/template"
"sync"
"time"
"github.com/spf13/hugo/helpers"
)
type Node struct {
@ -51,6 +52,9 @@ func (n *Node) HasMenuCurrent(menuID string, inme *MenuEntry) bool {
if me.IsSameResource(child) {
return true
}
if n.HasMenuCurrent(menuID, child) {
return true
}
}
}

View file

@ -626,6 +626,9 @@ func (p *Page) HasMenuCurrent(menu string, me *MenuEntry) bool {
if child.IsEqual(m) {
return true
}
if p.HasMenuCurrent(menu, child) {
return true
}
}
}
}