Pixelated Tech Blog

Pixelated Technologies is a Digital Services company that specializes in transforming small businesses through custom IT solutions, including web development, social media marketing, search engine optimization, content management, eCommerce solutions, and small business modernization. Our mission is to empower small businesses to thrive in the digital age by providing tailored technology services that drive growth and efficiency.

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.


Discover more from Pixelated Tech Blog

Subscribe to get the latest posts sent to your email.

Leave a Reply

Discover more from Pixelated Tech Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading