This is a migrated post from my former blog at bloodsweatand.net. It was originally posted 2009-03-18.
An XML sitemap is a great way to help crawlers such as Google, MSN Search, Yahoo and ASK.com to crawl your site and also allow you to tell them how important pages on your site are relative to each other.
I created a ASP.NET handler that generates such an XML sitemap for this site, and of course you are welcome to download the source code (a Visual Studio 2008 project).
The project contains two files, a sample robots.txt which help crawlers find your sitemap and the handler, Sitemap.ashx. To implement it on your own site modify the GetSitemapPages method in Sitemap.ashx.cs to return a list of pages in your site.
For the impatient it is also possible to tell the major search engines about your sitemap by using their webmaster tools. You can also ping Google and MSN by making HTTP requests to http://www.google.com/webmasters/tools/ping?sitemap=http://www.yoursite.com/XmlSitemap.ashx and http://webmaster.live.com/ping.aspx?siteMap=http://www.yoursite.com/XmlSitemap.ashx. Note that you shouldn't ping them more than once per hour though, or you may anger the all mighty search engine gods.
PS. For updates about new posts, sites I find useful and the occasional rant you can follow me on Twitter. You are also most welcome to subscribe to the RSS-feed.
This blog is built with EPiServer Community, EPiServer CMS, ASP.NET MVC and a bunch of other great products. The source code is available for download at the projects page, where you also can read more about this site and my other projects.
read more
Comments
Dave Nicoll 1 years ago
Great post. Have you considered adding this to codeplex?
Joel Abrahamsson 1 years ago
Thanks Dave!
I haven't considered adding it to Codeplex as I have regarded this as more of a stub than a complete framework for XML sitemaps. But perhaps I'll make it more complete in the future and make it into a real open source project.
Baume Mercier 1 years ago
Hmm strange this post is totaly irrelevant to the search query I entered in google but it was listed on the first page.
Joel Abrahamsson 1 years ago
Well, this site has a XML-sitemap, maybe that helped it to get on the first page ;)
sulumits retsambew 1 years ago
I see you are using Blogengine.net
Let me tell you, it is the best... I love it.
proactol 1 years ago
nice post. thanks
Dale 9 months ago
the zip file is corrupted