Generating sitemap.xml files in C#

One of the things that I would like to tackle before the end of the year is including sitemap.xml files with all of the new sites that my team develops. We could generate these files manually, but this would be tedious at best. There are a number of tools that will generate these files for you. Some of them are stand-alone desktop applications (Sitemap XML). Some web-based tools are built in PHP (AutoSitemap), Perl (TM Google Sitemap Generator), Python (Google WebMaster Tools), etc., and you can use in your own local environments. There is even a web site that you can submit your URL and it will generate the sitemap.xml file for you (XML Sitemaps).

My requirements for this feature are pretty simple:

  • Something built in C#
  • Something we can include in our projects
  • Something that can be run as part of our build process
  • Something that can be completely hands-free

So far, the only thing that I have found is the GoogleSiteMapProvider on the CodeProject web site. This project:

  • [Is] instantly useable with the majority of ASP.NET applications
  • [Is] a full ‘binary’ solution – no integration of code or compiling – just drop in a binary, modify the web.config and go
  • [Is] extendable so that more complicated ASP.NET applications could redefine the provider without restriction

It seems like this is a great fit for our architecture. The solution was to have a single assembly with three main types:

  1. An HTTP Handler which would return the XML on request (called GoogleSiteMapHandler)
  2. A Provider Type (called GoogleSiteMapProvider)
  3. A Controller class to glue the Handler and Provider together

This is a great place for us to start. The source code is available, it seems to fit my needs, and is simple to use.

Anyone else using something different? Do you have any other ideas? Have you found any other tools that might be useful for this? Leave a comment and let me know.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s