Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MVC sitemap provider & css styling

Does anyone know how to customise the rendering of the MVC sitemap provider so my ul element has a specific css class?

like image 461
jaffa Avatar asked Nov 29 '25 22:11

jaffa


1 Answers

Try MvcSiteMapProvider hosted on CodePlex. You should be able to fairly easily migrate your existing Sitemap file to the slightly different but essentially compatible format. This will give you the ability to output your sitemap using the simple Html.MvcSiteMap().SiteMap() helper method.

The source of the project includes the default templates which you can edit to produce any rendering you like...or just pass in the name of a template in accordance with MVC convention. The model types you'll be rendering are SiteMapHelperModel, SiteMapNodeModel and SiteMapNodeModelList (namespaces removed for terseness).

I appreciate this may not be exactly what you're after as it relies on a 3rd party tool but its a useful project that supports much more than just rendering sitemaps. You'll want version 3.0.0 for MVC3.

Dan

like image 172
Dan Kendall Avatar answered Dec 01 '25 12:12

Dan Kendall



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!