ref: 2b91b480d01cfcd4b13922effb25d83bc5dd3fb2
parent: b4871787f02d6660da8bc82b951178dc3964d9a9
author: Danny Sung <[email protected]>
date: Mon Mar 30 18:44:08 EDT 2015
IsMenuCurrent now resolving correctly when baseUrl is not at the root path
--- a/hugolib/node.go
+++ b/hugolib/node.go
@@ -18,6 +18,7 @@
"html/template"
"sync"
"time"
+ "strings"
)
type Node struct {
@@ -56,8 +57,20 @@
}
func (n *Node) IsMenuCurrent(menuID string, inme *MenuEntry) bool {
+ s := n.Site
me := MenuEntry{Name: n.Title, URL: n.URL}
+
+ if strings.HasPrefix(me.URL, "/") {
+ // make it match the nodes
+ menuEntryURL := me.URL
+ menuEntryURL = helpers.URLizeAndPrep(menuEntryURL)
+ if !s.canonifyURLs {
+ menuEntryURL = helpers.AddContextRoot(string(s.BaseURL), menuEntryURL)
+ }
+ me.URL = menuEntryURL
+ }
+
if !me.IsSameResource(inme) {
return false
}