Home / Blog

Sitemaps.NET

09 September 2007 Filed under: ,

Sitemaps.NET is a website plugin that automatically generates an XML sitemap of your content. Sitemaps.NET reuses a site's existing ASP.NET sitemap and automatically mirrors changes in your site to search engines.

Sitemaps.NET CodePlex Project

Sitemaps.NET Download

Features

  • Quickly generate XML sitemaps for search engines
  • Integrates with the ASP.NET sitemap functionality, automatically mirrors changes to search engines
  • Specify the priority and update frequency of content within your site on a page by page basis.
  • Simple plug in installation

Installation

  1. Extract Newtonsoft.Sitemaps.dll from the archive's /bin directory into your own applications.
  2. Add the SitemapHandler to your web.config's httpHandler section.

    <add verb="*" path="sitemap.axd" type="Newtonsoft.Sitemaps.SitemapHandler, Newtonsoft.Sitemaps"/>
    The path will determine the URL you submit to search engines. In the example above, for this site, the generated XML would be accessed with the URL http://www.newtonsoft.com/sitemap.axd.
  3. That's it. Now let search engines know about your sitemap file. Instructions can be found here. If you want to submit your sitemap directly to Google, login with your Google account here and submit the URL to the sitemap XML.

Arguments

These querystring arguments are passed to search engines when submitting the URL to your sitemap.

formatting

The written XML format. This value is constrained by the Formatting enum. Default value is Indented.

  • Indented
  • None
useFileModifiedDate

If a SiteMapNode doesn't have a lastmod date and this option is true then Sitemaps.NET will attempt to get the lastmod date from the physical file. Default value is false.

SiteMapNode Element Options 

In addition to defining a list of the URL's that make up your website, you can also supply metadata to search engines about each page. This metadata is define in your web.sitemap file against a SiteMapNode.

lastmod The date of last modification of the file. This can be any valid DateTime string.
changefreq

How frequently the page is likely to change. This value is constrained by the ChangeFrequency enum.

  • Always
  • Hourly
  • Daily
  • Weekly
  • Monthly
  • Yearly
  • Never
priority A decimal indicating priority of this URL relative to other URLs on your site. Valid values range from 0.0 to 1.0. The default priority of a page is 0.5.

Below is an example SiteMapNode from the web.sitemap file.

<siteMapNode url="~/products/sitemaps/quickstart.aspx"
    title="Quickstart guide" priority="0.5" lastmod="12/12/2005"
    changefreq="Monthly"/>

 

Comments

Joakim | 22 September 2007 05:49 AM

I use the Web Client Factory with the Enterprise Library which automatically uses the application root path type which starts with a tidle. Ex ("~/Default.aspx")

I had to modify your application to detect this and strip the tilde from the paths in SitemapWriter.cs. Perhaps you could include this fix in the next version?

Nevertheless, a great app with minimal impact to get a google sitemap. Nice!

john | 29 September 2007 04:02 AM

how can i check the resulting xml?

http://siteurl/sitemap.axd returns 404

Mike Flynn | 1 October 2007 08:56 PM

How do I test if useFileModifiedDate is working?  Do I have to set anything?

cblaze22@gmail.com

James Newton-King | 8 October 2007 05:56 PM

john:

sitemap.axd returns the sitemap XML. It is dynamically generated and returned in the response.

James Newton-King | 8 October 2007 06:02 PM

Mike:

Visit yousite/sitemap.axd?useFileModifiedDate=true

lastmod elements should appear in the sitemap XML.

Nebbercracker | 11 October 2007 06:56 PM

James, I know I saw it somewhere, but I cannot find it now. How do I ensure that some entries in my ASP.NET sitemap do not show in the generated sitemap XML? Good job, and thanks for sharing your work.

Nebbercracker | 11 October 2007 06:58 PM

Found it!! Ability to ignore URLs in your ASP.NET sitemap by adding the attribute sitemapsIgnore="true"

Leave a Comment

(required) 

(optional)

(required) 

Enter the code you see below: