mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
Fix section menus for lazy blogger
IsMenuCurrent was always returning false for the top level entries. Fixes #2065
This commit is contained in:
parent
dde967d8ca
commit
c0cf1a7e37
2 changed files with 1 additions and 4 deletions
|
@ -435,9 +435,6 @@ func doTestSectionPagesMenu(canonifyUrls bool, t *testing.T) {
|
|||
assert.NotNil(t, fishySectionMenuEntry)
|
||||
assert.NotNil(t, nodeFishy)
|
||||
|
||||
firstSectionMenuEntry.URL = firstSectionMenuEntry.URL + "/"
|
||||
secondSectionMenuEntry.URL = secondSectionMenuEntry.URL + "/"
|
||||
fishySectionMenuEntry.URL = fishySectionMenuEntry.URL + "/"
|
||||
assert.True(t, nodeFirst.IsMenuCurrent("spm", firstSectionMenuEntry))
|
||||
assert.False(t, nodeFirst.IsMenuCurrent("spm", secondSectionMenuEntry))
|
||||
assert.False(t, nodeFirst.IsMenuCurrent("spm", fishySectionMenuEntry))
|
||||
|
|
|
@ -1192,7 +1192,7 @@ func (s *Site) assembleMenus() {
|
|||
if sectionPagesMenu != "" {
|
||||
if _, ok := sectionPagesMenus[p.Section()]; !ok {
|
||||
if p.Section() != "" {
|
||||
me := MenuEntry{Identifier: p.Section(), Name: helpers.MakeTitle(helpers.FirstUpper(p.Section())), URL: s.Info.createNodeMenuEntryURL("/" + p.Section())}
|
||||
me := MenuEntry{Identifier: p.Section(), Name: helpers.MakeTitle(helpers.FirstUpper(p.Section())), URL: s.Info.createNodeMenuEntryURL("/" + p.Section() + "/")}
|
||||
if _, ok := flat[twoD{sectionPagesMenu, me.KeyName()}]; ok {
|
||||
// menu with same id defined in config, let that one win
|
||||
continue
|
||||
|
|
Loading…
Reference in a new issue