diff options
author | Bjørn Erik Pedersen <[email protected]> | 2019-04-19 09:18:12 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2019-04-19 10:29:52 +0200 |
commit | ea529c847ebc0267c6d0426cc8f77d5c76c73fe4 (patch) | |
tree | 501375833664d888e26e220b721dc375662895a2 /navigation/pagemenus.go | |
parent | 6c80acbd5e314dd92fc075551ffabafaae01dca7 (diff) | |
download | hugo-ea529c847ebc0267c6d0426cc8f77d5c76c73fe4.tar.gz hugo-ea529c847ebc0267c6d0426cc8f77d5c76c73fe4.zip |
Fix menu URL when multiple permalinkable output formats
In Hugo `0.55` we introduced the `permalinkable` config attribute on Output Format, default enabled for `AMP` and `HTML`.
This meant that a Page could have different `RelPermalink` and `Permalink` depending on the rendering format.
The menu `URL` did not reflect that fact.
Fixes #5849
Diffstat (limited to 'navigation/pagemenus.go')
-rw-r--r-- | navigation/pagemenus.go | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/navigation/pagemenus.go b/navigation/pagemenus.go index c0d809ee3..4d2c45767 100644 --- a/navigation/pagemenus.go +++ b/navigation/pagemenus.go @@ -50,9 +50,7 @@ func PageMenusFromPage(p Page) (PageMenus, error) { return nil, nil } - link := p.RelPermalink() - - me := MenuEntry{Page: p, Name: p.LinkTitle(), Weight: p.Weight(), URL: link} + me := MenuEntry{Page: p, Name: p.LinkTitle(), Weight: p.Weight()} // Could be the name of the menu to attach it to mname, err := cast.ToStringE(ms) @@ -81,7 +79,7 @@ func PageMenusFromPage(p Page) (PageMenus, error) { } for name, menu := range menus { - menuEntry := MenuEntry{Page: p, Name: p.LinkTitle(), URL: link, Weight: p.Weight(), Menu: name} + menuEntry := MenuEntry{Page: p, Name: p.LinkTitle(), Weight: p.Weight(), Menu: name} if menu != nil { ime, err := cast.ToStringMapE(menu) if err != nil { @@ -153,7 +151,7 @@ func (pm *pageMenus) HasMenuCurrent(menuID string, me *MenuEntry) bool { // The following logic is kept from back when Hugo had both Page and Node types. // TODO(bep) consolidate / clean - nme := MenuEntry{Page: pm.p, Name: pm.p.LinkTitle(), URL: pm.p.RelPermalink()} + nme := MenuEntry{Page: pm.p, Name: pm.p.LinkTitle()} for _, child := range me.Children { if nme.IsSameResource(child) { @@ -183,7 +181,7 @@ func (pm *pageMenus) IsMenuCurrent(menuID string, inme *MenuEntry) bool { // The following logic is kept from back when Hugo had both Page and Node types. // TODO(bep) consolidate / clean - me := MenuEntry{Page: pm.p, Name: pm.p.LinkTitle(), URL: pm.p.RelPermalink()} + me := MenuEntry{Page: pm.p, Name: pm.p.LinkTitle()} if !me.IsSameResource(inme) { return false |