I had a pretty good day. How ’bout you? I spent some time today with Ben Tiedt’s Dynamic Navigation Add-On for Community Server. I needed a submenu on a client Community Server project and whenever I have the opportunity to work with a Ben Tiedt add-on, I’m taking it.
Like all of Ben’s work, this add-on is the tops. I’m blogging about it because while the readme.txt was good, I had trouble working through the setup to create a submenu. Here’s a sample of a submenu generated by the add-on. What’s very slick here and not shown is that a different submenu can easily be configured to display with each main menu item.
By adding the dynamicNavigation group element to the theme.config, configuration options will appear in the Control Panel -> Customize Site Theme panel. Below is a screenshot of the configuration, and I wanted to display it because I didn’t grasp this right away. Each submenu (or child menu item if using the dropdown option) is preceded with a space and placed under its parent menu item. “Services” and “Products” reflected in the example above are listed under “Home” with a space. Thus to create a single submenu for all main menu items, we’d duplicate those items under each parent menu item.
To create a submenu we’d add an additional <GetBen:NavigationList /> control to our master.Master file and set its Level property to “1”. Sidebar: <GetBen: /> I like that!
Another smart feature of the add-on is that it bases menu highlighting on location. The downside is that you can’t override locally with a <CSControl:SelectedNavigation />. The good news is that Ben provides the full source code so we can always change it.