Revert "Make Urls in menus respect CanonifyUrls"

This reverts commit 3ccb397902.
This commit is contained in:
bep 2014-12-11 05:33:40 +01:00
parent 3ccb397902
commit 9b04c27998
4 changed files with 7 additions and 8 deletions

View 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

View 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
}

View 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}

View 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{}
}