Section menu for the lazy blogger

The current menu system works great, but is too much work if all you want is a simple menu with the sections as menu items, and having these menu items connected to the pages in a way that enables setting the correct menu item as active for both the section lists and the pages itself.

This commit adds a new option `SectionPagesMenu' which, if set, will create a new menu with that name with all the sections as menu items. The pages in the sections will behave as "shadow members" of these section items as `blogpage.HasMenuCurrent "sectionmenu" $sectionmenuitem` will return true.

If a menu item with the same `identifier` is defined in site config, *that* item will take precedence.
This commit is contained in:
bep 2015-01-06 18:11:06 +01:00 committed by spf13
parent beb4ab162d
commit d4acacd4f5
4 changed files with 35 additions and 4 deletions

View file

@ -104,7 +104,7 @@ func init() {
// This message will be shown to Windows users if Hugo is opened from explorer.exe
cobra.MousetrapHelpText = `
Hugo is a command line tool
You need to open cmd.exe and run it from there.`
@ -153,6 +153,7 @@ func InitializeConfig() {
viper.SetDefault("PaginatePath", "page")
viper.SetDefault("Blackfriday", helpers.NewBlackfriday())
viper.SetDefault("RSSUri", "index.xml")
viper.SetDefault("SectionPagesMenu", "")
if hugoCmdV.PersistentFlags().Lookup("buildDrafts").Changed {
viper.Set("BuildDrafts", Draft)