commit 247574976ce50c74c83a6a5fbc2137dbe24abe28
parent 354192d2b8b18f92966f77e156a9f09d0570ec98
Author: Valere JEANTET <valere.jeantet@gmail.com>
Date: Thu, 25 Jun 2015 12:26:48 +0200
Allow page.HasMenuCurrent() and node.HasMenuCurrent() to proceed with multi-level nested menus
Currently HasMenuCurrent only process the first 2 levels.
Diffstat:
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/hugolib/node.go b/hugolib/node.go
@@ -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
+ }
}
}
diff --git a/hugolib/page.go b/hugolib/page.go
@@ -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
+ }
}
}
}