Creating a first sitemap

Shad Storhaug edited this page Feb 9, 2014 · 1 revision

Want to contribute? See our Contributing to MvcSiteMapProvider guide.



Version 4.x Documentation


Unofficial Documentation and Resources

Other places around the web have some documentation that is helpful for getting started and finding answers that are not found here.

Tutorials and Demos

Version 4.x
Version 3.x

Forums and Q & A Sites

Other Blog Posts

Clone this wiki locally

The following is a simple sitemap XML file that can be used with the MvcSiteMapProvider:

<?xml version="1.0" encoding="utf-8" ?> 
<mvcSiteMap xmlns="http://mvcsitemap.codeplex.com/schemas/MvcSiteMap-File-3.0" enableLocalization="true"> 
  <mvcSiteMapNode title="Home" controller="Home" action="Index" changeFrequency="Always" updatePriority="Normal"> 
    <mvcSiteMapNode title="Browse Store" controller="Store" action="Index" /> 
    <mvcSiteMapNode title="Checkout" controller="Checkout" /> 
  </mvcSiteMapNode> 
</mvcSiteMap>

The following attributes can be given on an XML node element:
Attribute Required? Default Description
title Yes (empty) The title of the node.
description No (empty) Description of the node.
area No (empty) The MVC area for the sitemap node. If not specified, it will be inherited from a node higher in the hierarchy.
controller Yes (empty) The MVC controller for the sitemap node. If not specified, it will be inherited from a node higher in the hierarchy.
action Yes (empty) The MVC action method for the sitemap node. If not specified, it will be inherited from a node higher in the hierarchy.
key No (autogenerated) The unique identifier for the node.
url No (autogenerated based on routes) The URL represented by the node.
roles No (empty) Comma-separated list of roles allowed to access the node and its child nodes.
httpMethod No * The HTTP method that will be used to check node accessibility. This value is used to select correct controller action if a controller has multiple action accepting different HTTP verbs. Set to * to use HTTP method of current request.
resourceKey No (empty) Optional resource key.
clickable No True Is the node clickable or just a grouping node?
targetFrame No (empty) Optional target frame for the node link.
imageUrl No (empty) Optional image to be shown by supported HtmlHelpers.
lastModifiedDate No (empty) Last modified date for the node.
changeFrequency No Undefined Change frequency for the node.
updatePriority No Undefined Update priority for the node.
dynamicNodeProvider No (empty) A class name implementing MvcSiteMapProvider.Extensibility.IDynamicNodeProvider and providing dynamic nodes for the site map.
urlResolver No Sitemap provider's ISiteMapNodeUrlResolver instance Class that will be used to generate URLs for sitemap nodes.
visibilityProvider No Sitemap provider's ISiteMapNodeVisibilityProvider instance Class that will be used to determine visibility for a sitemap node.
preservedRouteParameters No (empty) Optional preserved route parameter names (= values that will be used from the current request route).
inheritedRouteParameters No (empty) Optional. Route values that should be inherited from the parent sitemap node. This is not a replacement for the SiteMapPreserveRouteDataAttribute.