Try our conversational search powered by Generative AI!

Anton Kallenberg
Jun 19, 2012
  2609
(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
Optimizely and the never-ending story of the missing globe!

I've worked with Optimizely CMS for 14 years, and there are two things I'm obsessed with: Link validation and the globe that keeps disappearing on...

Tomas Hensrud Gulla | Apr 18, 2024 | Syndicated blog

Visitor Groups Usage Report For Optimizely CMS 12

This add-on offers detailed information on how visitor groups are used and how effective they are within Optimizely CMS. Editors can monitor and...

Adnan Zameer | Apr 18, 2024 | Syndicated blog

Azure AI Language – Abstractive Summarisation in Optimizely CMS

In this article, I show how the abstraction summarisation feature provided by the Azure AI Language platform, can be used within Optimizely CMS to...

Anil Patel | Apr 18, 2024 | Syndicated blog

Fix your Search & Navigation (Find) indexing job, please

Once upon a time, a colleague asked me to look into a customer database with weird spikes in database log usage. (You might start to wonder why I a...

Quan Mai | Apr 17, 2024 | Syndicated blog

The A/A Test: What You Need to Know

Sure, we all know what an A/B test can do. But what is an A/A test? How is it different? With an A/B test, we know that we can take a webpage (our...

Lindsey Rogers | Apr 15, 2024

.Net Core Timezone ID's Windows vs Linux

Hey all, First post here and I would like to talk about Timezone ID's and How Windows and Linux systems use different IDs. We currently run a .NET...

sheider | Apr 15, 2024