Wednesday, June 5, 2013

Sitemap generator

Someone wanted a sitemap for our company website. So I started out by Googling for sitemap generators. After all, this seems like a rather simple tool and there should be plenty.

I tried out a few, including Google Sitemap Generator. This ended up not really working at all. I followed the manual and everything and it just wouldn't work.

So finally I threw my hands up and said "Fuck this, i'm a programmer." Less than an hour later I had completed a simple sitemap generator that would work for my needs.

I only have ASP.NET pages, with dynamic content, but no dynamically generated pages, so all I really needed to do was traverse my website's directory structure and write out XML in the sitemap format.

I used this site to validate outputted sitemap file:

Here's the code:

No comments:

Post a Comment