Revert "Make Urls in menus respect CanonifyUrls"
authorbep <bjorn.erik.pedersen@gmail.com>
Thu, 11 Dec 2014 04:33:40 +0000 (05:33 +0100)
committerbep <bjorn.erik.pedersen@gmail.com>
Thu, 11 Dec 2014 04:33:40 +0000 (05:33 +0100)
This reverts commit 3ccb3979028aafb3e6cc16d47daa77a1fdea11fa.

hugolib/menu_test.go
hugolib/node.go
hugolib/page.go
hugolib/site.go

index 8a3fd04d348bff7a3a2e58338589c779953f0302..2336169a2a041ebcecce51e9ae68232d4cfe95f4 100644 (file)
@@ -182,7 +182,7 @@ func TestHomeNodeMenu(t *testing.T) {
        defer resetMenuTestState(ts)
 
        home := ts.site.newHomeNode()
-       homeMenuEntry := &MenuEntry{Name: home.Title, Url: home.Url}
+       homeMenuEntry := &MenuEntry{Name: home.Title, Url: string(home.Permalink)}
 
        for i, this := range []struct {
                menu           string
index 1f50e85e3fa4a701df6731d1e1b0d1526a3476bf..be47863905d9671de27ef6ffed67fa1af94358e9 100644 (file)
@@ -38,7 +38,7 @@ func (n *Node) Now() time.Time {
 
 func (n *Node) HasMenuCurrent(menuId string, inme *MenuEntry) bool {
        if inme.HasChildren() {
-               me := MenuEntry{Name: n.Title, Url: n.Url}
+               me := MenuEntry{Name: n.Title, Url: string(n.Permalink)}
 
                for _, child := range inme.Children {
                        if me.IsSameResource(child) {
@@ -52,7 +52,8 @@ func (n *Node) HasMenuCurrent(menuId string, inme *MenuEntry) bool {
 
 func (n *Node) IsMenuCurrent(menuId string, inme *MenuEntry) bool {
 
-       me := MenuEntry{Name: n.Title, Url: n.Url}
+       me := MenuEntry{Name: n.Title, Url: string(n.Permalink)}
+
        if !me.IsSameResource(inme) {
                return false
        }
index 6e4c887a1e12250d8aff6b6363f3f72d46df08e4..67a6842c1ad80d9db7d2eb05b9028a5624e9d19a 100644 (file)
@@ -473,7 +473,7 @@ func (page *Page) Menus() PageMenus {
        ret := PageMenus{}
 
        if ms, ok := page.Params["menu"]; ok {
-               link, _ := page.RelPermalink()
+               link, _ := page.Permalink()
 
                me := MenuEntry{Name: page.LinkTitle(), Weight: page.Weight, Url: link}
 
index d5385081bf77289558aa9aa6a1403e18a8b2d831..b17a19280ab9cad49f37fa27b9a76e735ee5180d 100644 (file)
@@ -532,12 +532,10 @@ func (s *Site) getMenusFromConfig() Menus {
                                        }
 
                                        menuEntry.MarshallMap(ime)
-
                                        if strings.HasPrefix(menuEntry.Url, "/") {
-                                               // make it match the nodes
-                                               menuEntry.Url = s.prepUrl(menuEntry.Url)
+                                               // make it absolute so it matches the nodes
+                                               menuEntry.Url = s.permalinkStr(menuEntry.Url)
                                        }
-
                                        if ret[name] == nil {
                                                ret[name] = &Menu{}
                                        }