Skip to content

Creating a first sitemap

kradcliffe edited this page Jan 22, 2012 · 2 revisions

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.
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.