mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -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
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue