maartenba / MvcSiteMapProvider

An ASP.NET MVC SiteMapProvider implementation for the ASP.NET MVC framework.
Microsoft Public License
537 stars 220 forks source link

SiteMapPathHelperModel Nodes are empty after adding custom attribute #441

Open codePitcher opened 8 years ago

codePitcher commented 8 years ago

Recently I added two new 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

NightOwl888 commented 8 years ago

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.