shithub: hugo

Download patch

ref: 247574976ce50c74c83a6a5fbc2137dbe24abe28
parent: 354192d2b8b18f92966f77e156a9f09d0570ec98
author: Valere JEANTET <[email protected]>
date: Thu Jun 25 08:26:48 EDT 2015

Allow page.HasMenuCurrent() and node.HasMenuCurrent() to proceed with multi-level nested menus
Currently HasMenuCurrent only process the first 2 levels.

--- 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 {
@@ -49,6 +50,9 @@
 
 		for _, child := range inme.Children {
 			if me.IsSameResource(child) {
+				return true
+			}
+			if n.HasMenuCurrent(menuID, child) {
 				return true
 			}
 		}
--- a/hugolib/page.go
+++ b/hugolib/page.go
@@ -626,6 +626,9 @@
 				if child.IsEqual(m) {
 					return true
 				}
+				if p.HasMenuCurrent(menu, child) {
+					return true
+				}
 			}
 		}
 	}