forked from maartenba/MvcSiteMapProvider
-
Notifications
You must be signed in to change notification settings - Fork 0
Defining sitemap nodes in code
weitzhandler edited this page Nov 15, 2012
·
3 revisions
In some cases, defining a sitemap node in code is more convenient than defining it in a sitemap xml file. To do this, decorate an action method with the MvcSiteMapNodeAttribute attribute. For example:
// GET: /Checkout/Complete
[MvcSiteMapNodeAttribute(Title = "Checkout complete", ParentKey = "Checkout")]
public ActionResult Complete(int id)
{
// ...
}
Note that the ParentKey property should be specified to ensure the MvcSiteMapProvider can determine the hierarchy for all nodes. Only one node can exist without a ParentKey defined. This node will be used as the parent node for all others.