mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
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:
parent
354192d2b8
commit
247574976c
2 changed files with 8 additions and 1 deletions
|
@ -14,10 +14,11 @@
|
||||||
package hugolib
|
package hugolib
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/spf13/hugo/helpers"
|
|
||||||
"html/template"
|
"html/template"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/spf13/hugo/helpers"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Node struct {
|
type Node struct {
|
||||||
|
@ -51,6 +52,9 @@ func (n *Node) HasMenuCurrent(menuID string, inme *MenuEntry) bool {
|
||||||
if me.IsSameResource(child) {
|
if me.IsSameResource(child) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
if n.HasMenuCurrent(menuID, child) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -626,6 +626,9 @@ func (p *Page) HasMenuCurrent(menu string, me *MenuEntry) bool {
|
||||||
if child.IsEqual(m) {
|
if child.IsEqual(m) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
if p.HasMenuCurrent(menu, child) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue