Take the community feedback survey now.

Anton Kallenberg
Jun 19, 2012
  3418
(0 votes)

Adding a site map index

I have created a add-on that adds a site map index to a EPiServer site based on the page tree structure. I have used the protocol that is described here http://www.sitemaps.org/protocol.html#index

The implementation is based on a http handler that must be registered in web.config,  would be great if the registration could be done through code, maybe in a initialization module, is this possible?

Add a reference to the SiteMapIndex.dll and add following to Web.config ( /configuration/system.webServer/handlers)

   1: <add name="SiteMapIndex" 
   2:            path="sitemap.xml"
   3:            verb="*"
   4:            type="SiteMapIndex.IndexHandler, SiteMapIndex" />
   5:       <add name="SiteMapItem"
   6:            path="sitemapitem.xml"
   7:            verb="*"
   8:            type="SiteMapIndex.IndexHandler, SiteMapIndex" />

Browse to http://yoursite.com/sitemap.xml to view the site map index.

Excluding pages, setting change frequency and priority

It is possible to change the behavior of these things. Implement the interface ISiteMapIndexPageType to your page type builder page type class and implement the properties from the interface.

   1: #region ISiteMapIndexPageType
   2: bool ISiteMapIndexPageType.Skip
   3: {
   4:     get { return false; }
   5: }
   6:  
   7: ChangeFrequency ISiteMapIndexPageType.ChangeFrequency
   8: {
   9:     get { return ChangeFrequency.Weekly; }
  10: }
  11:  
  12: double ISiteMapIndexPageType.Priority
  13: {
  14:     get { return 0.7; }
  15: }
  16: #endregion

Caching

It could be a quite heavy operation to render the site map index for big site. Now only page references are cached in addition to episerver standard caching of page data objects. A cache dependency is added to the global episerver version key. If a page is updated the entire cache (of page references) for the site map index is dropped. Do you think the outputted xml should be cached instead of the page references or maybe something completely different?

Source and downloads are available at github. https://github.com/antonkallenberg/SiteMapIndex

Requires PageTypeBuilder 2.0 and EPiServer 6 R2.

Jun 19, 2012

Comments

Please login to comment.
Latest blogs
Extending Application Insights in an Optimizely PaaS CMS Solution

As part of a recent Optimizely DXP project, I needed richer telemetry from the Content Delivery API than the default Application Insights integrati...

Minesh Shah (Netcel) | Sep 24, 2025

How to obtain a Optimizely CMS SaaS developer instance (2025)

There are a spread collection of how to work with CMS SaaS but no (current working) information how to obtain a developer instance. Here is how....

Jonas Boman | Sep 24, 2025

Playing with MCP: An Experimental Server for Optimizely CMS

I’ve been tinkering with something experimental: an MCP server for Optimizely CMS. MCP, or Model Context Protocol, is a way for AI tools to talk to...

Johnny Mullaney | Sep 24, 2025 |

Extending Optimizely Opal with Custom Tools and Agents

In we looked at Opal’s role as an AI workflow manager in the Optimizely stack. Now let’s go deeper and see how you can extend Opal with your own...

Matt Damon | Sep 23, 2025 |

Optimizely Opal: AI Assistant and Workflow Manager for the Modern DXP

Introduction Most AI assistants today focus on point productivity—generating text, summarizing documents, or suggesting code. These tools are usefu...

Matt Damon | Sep 22, 2025 |

Optimizely SaaS CMS Developer Certification

I have recently passed the Optimizely SaaS CMS Developer Certification. Sharing my experience, hope this helps. https://academy.optimizely.com/stud...

Madhu | Sep 22, 2025 |