[转载]Sitemaps.NET – James Newton-King.
Sitemaps.NET
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.
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
- Extract Newtonsoft.Sitemaps.dll from the archive’s /bin directory into your own applications.
- Add the
SitemapHandler
to your web.config’shttpHandler
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.
- 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.
|
---|---|
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.
|
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"/>