As a general requirement some/almost all of our clients require the website’s sitemap to publish automatically whenever a page gets created and published. Generally we implement this functionality through the event system in Tridion.

There may be some pros and cons with this approach or alternative approaches to this problem.

What are the best practices for managing a website’s sitemap along with their pros and cons?

Alternative approaches with code snippets will be highly beneficial and appreciated.

  • Ram, I suggested some edits to your question to clarify what you are looking for. If you think I misstated what you are looking for feel free to reject my edits. Commented Mar 13, 2013 at 6:24
  • Very interesting question Commented Mar 13, 2013 at 14:45
  • Requirements to give authors the ability to preview navigation changes before making them live will affect the appropriate implementation. In this case a mix of automatic changes on staging with a manual decision for live (publish the "navigation" page) might be a good balance. Commented Aug 8, 2013 at 20:00

4 Answers 4


What we implement most of the times (for .NET front-end apps):

  • a table on the front-end DB to store the sitemap information
  • create a custom deployer to store sitemap information at publishing time
  • create a custom .NET sitemap provider using this custom table.

This way has (imo) following advantages:

  • sitemap is always up to date (each publish/unpublish action is taken into account)
  • no need to manually publish a sitemap file
  • generation of such a sitemap file can take a long time as it's probably going to loop over all pages in your structure.
  • you can use the .NET Sitemap provider to render your navigation, breadcrumbs, sitemap pages,...

You can find some code examples here: http://tridionrevealed.wordpress.com/2012/01/25/custom-deployer-sitemap/

  • +1. Cool, didn't catch the Tr3dionRevealed blog before. Is that yours, Kristof? Commented Mar 13, 2013 at 22:15

Generating a big XML on publish time is the easiest option but can be a time consuming action, specially as you will need to trigger republish on every page publish/unpublish. I have seen some sitemap publish taking minutes.

There are many options, but my favorite approach consists on 2 steps:

  1. publishing small XML fragments with every page publish/unpublish, this can be achieved via:

    • TBB that publish a binary together with the page
    • Storage Extension
  2. Create a dynamic page in the fronted that assembles all this small XMLs into a big one: Sitemap. Of course caching should be taken into account here, so the XML only gets refreshed when a new page is published.


DD4T comes with a TridionSiteMapProvider class so you generate an XML ASP.NET Sitemap in the same way described by Puntero using your own TBBs and then this gets published into the Broker DB by the DD4T templates. Your MVC application then uses that provider to get it from the database based on the page url you specify.

Obviously this has the same problems described above with regard to the time taken to publish with a large site because you're still generating the big XML even though it's not written to the filesystem. I like the sound Kristof's database table approach - sounds interesting.


It is frequently practiced to drive the site map from the structure groups defined in the CMS. But as you see from other answers there are quite a few approaches.

If you have a .NET website, then you can publish a web.sitemap file (just a type of XML file) from your SGs that easily plugs into out of the box .NET navigation user controls. Here is an article with code on how to do this: http://www.tridiondeveloper.com/web-sitemap

  • 2
    When using the Structure Groups to generate the navigation, it is most common to prefix the Structure Group names with numbers: 1. Products, 2. Solutions, etc. This allows you to easily determine/change the order in which the Structure Groups appear in the navigation and it implies that any Structure Group without a numeric prefix will not show up in the navigation (stuff like styles, images, etc). The prefixes also ensure that the Structure Groups show up in the Tridion GUI in the same order as on the web site, which helps users find stuff quickly. Commented Mar 13, 2013 at 12:51
  • +1 to the answer and Frank's comment. Anytime you have items in an organization item, you can add ordering through naming conventions or with metadata (e.g. a "priority" field). The catch with any org item approach is handling items in two sections of the same sitemap, which can be addressed with metadata and/or your favorite redirect techniques. Commented Mar 13, 2013 at 22:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.