views:

293

answers:

2

I'm building a regionalized site each region has it own sitemap and own content. The regions can be added at runtime. Is there any way to add a sitemap provider at runtime?

I need multiple site map providers at once so that I can leverage the mvcsitemap without to many changes.

+2  A: 

You can create your custom site map provider in order to take information from database or from another file than web.sitemap.

Example of database sitemap: http://msdn.microsoft.com/en-us/magazine/cc163657.aspx

Gregoire
But I need few different sitemap at once. Rebuilding the sitemap at each request could be quite resource consuming.
Piotr Czapla
It was jsut an example to show you how to build your own provider. You can build one that will deal with different sitemap
Gregoire
+1  A: 

There is an MVC sitemap provider available at: http://mvcsitemap.codeplex.com/

I'm using it for a project right now. It has caching functionality built into the code so your overhead shouldn't be too bad. Even in debug mode running the sitemap for every request takes < 100 ms so I wouldn't worry about performance.

Your performance concerns are a little yagni too. "Could be quite resource consuming". You don't know so your just prematurely optimizing.

jfar
I'm currently using mvcsitemap with few modification. But the requirements were changed (I need multiple _different_ site maps). I'm looking for a way to leverage mvcsitemap and still meet the customer needs.
Piotr Czapla
Re. Performance concerns - you are right. I've edited the question
Piotr Czapla