In my file Mvc.sitemap
, have the following node:
<mvcSiteMapNode title="Contato" controller="Home" action="Contato" classesCustomizadas="quebra contato" />
Web.config
attributesToIgnore="visibility, classesCustomizadas"
Full..
<siteMap defaultProvider="MvcSiteMapProvider" enabled="true">
<providers>
<clear />
<add name="MvcSiteMapProvider" type="MvcSiteMapProvider.DefaultSiteMapProvider, MvcSiteMapProvider"
siteMapFile="~/Mvc.Sitemap"
securityTrimmingEnabled="true"
cacheDuration="5"
enableLocalization="true"
scanAssembliesForSiteMapNodes="true"
includeAssembliesForScan=""
excludeAssembliesForScan=""
attributesToIgnore="visibility, classesCustomizadas"
nodeKeyGenerator="MvcSiteMapProvider.DefaultNodeKeyGenerator, MvcSiteMapProvider"
controllerTypeResolver="MvcSiteMapProvider.DefaultControllerTypeResolver, MvcSiteMapProvider"
actionMethodParameterResolver="MvcSiteMapProvider.DefaultActionMethodParameterResolver, MvcSiteMapProvider"
aclModule="MvcSiteMapProvider.DefaultAclModule, MvcSiteMapProvider"
siteMapNodeUrlResolver="MvcSiteMapProvider.DefaultSiteMapNodeUrlResolver, MvcSiteMapProvider"
siteMapNodeVisibilityProvider="MvcSiteMapProvider.FilteredSiteMapNodeVisibilityProvider, MvcSiteMapProvider"
siteMapProviderEventHandler="MvcSiteMapProvider.DefaultSiteMapProviderEventHandler, MvcSiteMapProvider" />
</providers>
</siteMap>
I edited the file "SiteMapNodeModel.cshtml" so he could work as follows:
@if (Model.IsCurrentNode && Model.SourceMetadata["HtmlHelper"].ToString() != "MvcSiteMapProvider.Web.Html.MenuHelper")
{
<text>@Model.Title</text>
}
else if (Model.IsClickable)
{
<a href="@Model.Url " class=">>>> Classes here <<<<<">@Model.Title</a>
}
else
{
<text>@Model.Title</text>
}
How to get the class configured in my file Mvc.sitemap
on attribute classesCustomizadas
and replace (>>>> Classes here <<<<<)?
The custom attributes are stored in the property MetaAttributes on SiteMapNodeModel.
Therefore you can get the class using: @Model.MetaAttributes["classesCustomizadas"]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With