Generating Web.Sitemap from Tridion (SiteMapDataSource)

In spirit of Nuno’s post last week (http://nunolinhares.blogspot.com/2012/01/its-little-things-creating-page.html) regarding website navigation and more specifically, how to generate a Breadcrumb from Structure Groups in Tridion, I thought it was time to publish a related post (and a TBB) I’ve been baking for a while now.  Behold: hooking up Tridion to .NET’s standard Navigation Controls.  I’m talking about Menu, SiteMapPath, and TreeView.  Turns out they all feed off the same, rather basic, XML file called web.sitemap.  Here is the C# code for a generic TBB that creates such a file from your SDL Tridion Web Structure Group and Pages hierarchy.

Continue reading