From c0cf1a7e37efd4b0ba8fcbec2b53632303861303 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Sun, 10 Apr 2016 13:49:32 +0200 Subject: [PATCH] Fix section menus for lazy blogger IsMenuCurrent was always returning false for the top level entries. Fixes #2065 --- hugolib/menu_test.go | 3 --- hugolib/site.go | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/hugolib/menu_test.go b/hugolib/menu_test.go index f8012bf9c..cd5128543 100644 --- a/hugolib/menu_test.go +++ b/hugolib/menu_test.go @@ -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)) diff --git a/hugolib/site.go b/hugolib/site.go index 1c6d0257c..4cb65b7fc 100644 --- a/hugolib/site.go +++ b/hugolib/site.go @@ -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