Try our conversational search powered by Generative AI!

Anton Kallenberg
Jun 19, 2012
  2655
(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
From Procrastination to Proficiency: Navigating Your Journey to Web Experimentation Certification

Hey there, Optimizely enthusiasts!   Join me in celebrating a milestone – I'm officially a certified web experimentation expert! It's an exhilarati...

Silvio Pacitto | May 17, 2024

GPT-4o Now Available for Optimizely via the AI-Assistant plugin!

I am excited to announce that GPT-4o is now available for Optimizely users through the Epicweb AI-Assistant integration. This means you can leverag...

Luc Gosso (MVP) | May 17, 2024 | Syndicated blog

The downside of being too fast

Today when I was tracking down some changes, I came across this commit comment Who wrote this? Me, almost 5 years ago. I did have a chuckle in my...

Quan Mai | May 17, 2024 | Syndicated blog

Optimizely Forms: Safeguarding Your Data

With the rise of cyber threats and privacy concerns, safeguarding sensitive information has become a top priority for businesses across all...

K Khan | May 16, 2024

The Experimentation Process

This blog is part of the series -   Unlocking the Power of Experimentation: A Marketer's Insight. Welcome back, to another insightful journey into...

Holly Quilter | May 16, 2024

Azure AI Language – Sentiment Analysis in Optimizely CMS

In the following article, I showcase how sentiment analysis, which is part of the Azure AI Language service, can be used to detect the sentiment of...

Anil Patel | May 15, 2024 | Syndicated blog