From 247574976ce50c74c83a6a5fbc2137dbe24abe28 Mon Sep 17 00:00:00 2001 From: Valere JEANTET Date: Thu, 25 Jun 2015 12:26:48 +0200 Subject: [PATCH] Allow page.HasMenuCurrent() and node.HasMenuCurrent() to proceed with multi-level nested menus Currently HasMenuCurrent only process the first 2 levels. --- hugolib/node.go | 6 +++++- hugolib/page.go | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/hugolib/node.go b/hugolib/node.go index 1732cac16..ecf5e32fa 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 96de47154..2bd19e13e 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 + } } } }