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