From: Valere JEANTET Date: Thu, 25 Jun 2015 10:26:48 +0000 (+0200) Subject: Allow page.HasMenuCurrent() and node.HasMenuCurrent() to proceed with multi-level... X-Git-Tag: v0.15~288 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=247574976ce50c74c83a6a5fbc2137dbe24abe28;p=brevno-suite%2Fhugo Allow page.HasMenuCurrent() and node.HasMenuCurrent() to proceed with multi-level nested menus Currently HasMenuCurrent only process the first 2 levels. --- diff --git a/hugolib/node.go b/hugolib/node.go index 1732cac1..ecf5e32f 100644 --- 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 index 96de4715..2bd19e13 100644 --- 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 + } } } }