Empty (placeholder) nodes

May 30, 2011 at 4:59 PM

It says here http://mvcsitemap.codeplex.com/wikipage?title=Creating%20a%20first%20sitemap&referringTitle=Home that  the route and controller are required values. I want to create some nodes that do not map to any of the routes in my web application - essentially they would have no link on them. I am using superfish JS menu on the generated UL structure by Menu() helper. While menu sub options will have links, the menu groups would only render the text.

For easiear understanding this is a snippet of my sitemap:

<mvcSiteMap xmlns="http://mvcsitemap.codeplex.com/schemas/MvcSiteMap-File-3.0" enableLocalization="true">
 <mvcSiteMapNode title="Home" controller="ContentPage" action="Display" id="1">
  <mvcSiteMapNode title="Company"> <!-- this doesn't work, this branch is not rendered -->
   <mvcSiteMapNode title="About us" controller="ContentPage" action="Display" id="2" slug="about-us" />
   <mvcSiteMapNode title="Contact" controller="ContentPage" action="Display" id="3" slug="contact" />

The Company menu will, using Superfish JS, expand the submenu but it should not have a link attached to it therefore no route matches it either (e.g. no content is related to that specific menu option).

Jun 7, 2011 at 4:13 PM
Edited Jun 7, 2011 at 4:16 PM

Asking once again (Maarten?!), how can we create nodes that do not link anywhere? (Without controller and action)

of course I have an empty route in place but the problem is it won't fit for all scenarios. What we need is an ability to render the list items without links (only text).

Could not resolve URL for sitemap node Home which represents action  in controller . Ensure that the route  for this sitemap node can be resolved and that its default values allow resolving the URL for the current sitemap node.

Jun 9, 2011 at 1:11 PM

It's not currently supported, but... If you don't specify controller & action and specify URL as # (or something you can recognize as being "empty"), you can modify the partial view templates to check for this and based on that make a node clickable or not.

Another option is to just specify clickable="false", like in the music store example.