Google Sitemaps for ASP.NET 2.0
Google has a little-known feature that enables web site authors to tell the search engine about the structure of their site. ASP.NET also has a way of representing the structure of the site in a map. ASP.NET SiteMaps can be exposed on the site using a Menu, TreeView or SiteMapPath control, but there is no built-in feature that exposes this information in the format that Google understands.
That's why I've developed a small handler that scans the
ASP.NET
SiteMap and formats it into the
Google XML format for site maps. Once you've copied this handler into your site, just
register it as your site map with Google from this page:
https://www.google.com/webmasters/sitemaps
I've also added a very simple control that displays the ASP.NET SiteMap in a very plain HTML form (using h1...h6 tags) that is likely to be well indexed by most search engines. The control's look can be very much improved on and customized but I'll leave that as an exercise for the reader.
The sample also comes with a sample site to demonstrate the use of the control and handler.
Download the project from here:http://www.gotdotnet.com/codegallery/codegallery.aspx?id=237330e0-65c5-4ebb-b62b-e486dd598604
UPDATE: I updated the handler so that it can now use Google-specific attributes. You can now specify additional information such as the update frequency of each page directly in the ASP.NET SiteMap (version 1.1 of the handler).
UPDATE 2: This implementation is now
obsolete. This feature is now part of the
ASP.NET Futures
release with a much more complete implementation. Check it
out!
http://www.asp.net/downloads/futures/default.aspx?tabid=62
UPDATE 3: I've added back the source code as an attachment for this post, for reference purposes (but I encourage everyone to use the Futures version).