0
votes

I have install MVCSitemapProvider on my MVC 3 application for breadcrumbs trail. It has auto generate following node in Mvc.sitemap.xml

<?xml version="1.0" encoding="utf-8" ?>
<mvcSiteMap xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns="http://mvcsitemap.codeplex.com/schemas/MvcSiteMap-File-3.0"
            xsi:schemaLocation="http://mvcsitemap.codeplex.com/schemas/MvcSiteMap-File-3.0 MvcSiteMapSchema.xsd"
            enableLocalization="true">

  <mvcSiteMapNode title="Home" controller="Home" action="Index">

    <mvcSiteMapNode title="About" controller="Home" action="About"/>
  </mvcSiteMapNode>

</mvcSiteMap>

And Following is the HTML Helper for displaying breadcrumbs

  @Html.MvcSiteMap().SiteMapPath()

In my application, there is lot of controller and their action that is hectic to add all mvcSiteMapNode in mvcSiteMap of those action and question is that Is it possible to list all controller and their respective action in mvcSiteMapNode of Mvc.sitemap.xml without writting all manually.

1

1 Answers

1
votes

I think the closest thing is using attributes on the methods, see https://github.com/maartenba/MvcSiteMapProvider/wiki/Defining-sitemap-nodes-in-code. Example:

// GET: /Checkout/Complete 
[MvcSiteMapNodeAttribute(Title = "Checkout complete", ParentKey = "Checkout")] 
public ActionResult Complete(int id) 
{ 
  // ... 
}