MvcSiteMapProvider
MvcSiteMapProvider copied to clipboard
SiteMapPathHelperModel Nodes are empty after adding custom attribute
Recently I added two new <mapSiteMapNode> to an existing Mvc.sitemap and all was find. These were appearing within a menu and breadcrumb.
Menu:
@Html.MvcSiteMap().Menu("BootstrapMenuHelperModel")
Using the model
MvcSiteMapProvider.Web.Html.Models.MenuHelperModel
Breadcrumb:
@Html.MvcSiteMap().SiteMapPath("BootStrapBreadcrumb")
Using the model
SiteMapPathHelperModel
Wanting to prevent the two new nodes from being displayed in the menu I added a new custom attribute to the mapSiteMapNodes and then within the BootstrapMenuHelperModel template I added logic to handle the custom attribute and prevent them from being displayed. All good so far.
However after adding the custom attribute I have notice that the breadcrumbs are not being displayed and when looking at the SiteMapPathHelperModel Nodes the count is zero, it was previously two. (Home and my new link)
Any ideas as to why custom attribute is preventing the SiteMapPathHelperModel Nodes from being populated.
Cheers
As per the documentation, you need to manually configure custom attributes to be ignored when matching route values by specifying them in the AttributesToIgnore
configuration setting.