Allow page.HasMenuCurrent() and node.HasMenuCurrent() to proceed with multi-level...
authorValere JEANTET <valere.jeantet@gmail.com>
Thu, 25 Jun 2015 10:26:48 +0000 (12:26 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Tue, 14 Jul 2015 19:31:47 +0000 (21:31 +0200)
Currently HasMenuCurrent only process the first 2 levels.

hugolib/node.go
hugolib/page.go

index 1732cac161751e80e99e91e90877d352f86c0c3e..ecf5e32fa2dd5ab171e4774e49ec935bad096bd6 100644 (file)
 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
+                       }
                }
        }
 
index 96de471546686f02f226c8b4978e1fe7f5383ffc..2bd19e13e80fd58db929db661934730595fdb841 100644 (file)
@@ -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
+                               }
                        }
                }
        }