Manually Creating an XML Sitemap

Posted on Jun 23, 2009


Sitemaps, as the name implies, are a map of your website. There are two types of sitemaps:

  • HTML – a web page you show the structure of your website. This type of sitemap is created for visitors to your website. (Example: Doteasy Site Map)
  • XML – a file you list all URLs of your website. This type is called “Sitemap” and is created for search engine crawlers

XML Sitemaps

XML Sitemaps offer the opportunity to inform search engines about your website.

Search engine crawlers usually discover pages from links within the site and from other sites. Sitemaps are particularly helpful if:

  • Your site has dynamic content
  • Your site uses rich Ajax or Flash (not normally processed by search engines)
  • Your site is new and has few links to it
  • Your site has a large archive of content pages that are not well linked to each other, or not available through the browsable interface some areas of the website

In addition, Sitemap allows webmasters to include additional information about each URL: when it was last updated, how often it changes and how important it is, relative to other URLs in the website. This allows search engines to crawl the site more intelligently.

NOTE: Sitemap does not guarantee that web pages are included in search engines nor does it influence the way that web pages are ranked in search results. By submitting Sitemaps to a search engine, a webmaster is only helping the engine’s crawlers do a better job of crawling their site.

Sitemap Generators

You can use a sitemap generator to create your sitemap. Google has a sitemap generator for creating a sitemap for a static web site.

Other sitemap generators and services:

Manually Creating a Sitemap

You can also manually create a Sitemap based on the Sitemap protocol.

1. Create a text file and save it with a .xml extension (ie. sitemap.xml)

2. First lines of the file:

<?xml version=”1.0″ encoding=”UTF-8″?>
<urlset xmlns=”http://www.sitemaps.org/schemas/sitemap/0.9″>

3. Create an entry for each URL. The <loc> tag is required, the others are optional.

<url>
<loc>http://www.example.com/</loc>
<lastmod>2005-01-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>

4. Last line of the file:

</urlset>

5. Upload the file to your server and then submit it to the search engines.

Element Definitions

Element Required? Notes
<loc> Y Provide the full URL of the page, including the protocol (ie. http, https). This value must be less than 2048 characters
<lastmod> N Provide the date that the file was last modified, in YYYY-MM-DD format.
<changefreq> N Possible values include: hourly, daily, weekly, monthly, yearly and never. This is only used as a guide for crawlers and is not used to determine how frequently pages are indexed.
<priority> N Allows webmasters to suggest to search engine crawlers which pages are considered more important. Valid range is from 0.0 to 1.0 (highest). The default value is 0.5. Rating all pages on a site with a high priority does not affect search engine lists.

Guidelines and Limitations

Keep in mind when creating your Sitemap file:

  • Sitemap files have a limit of 50,000 URLs and be no larger than 10MB when uncompressed.
  • The Sitemap URL can contain only ASCII characters.
  • Sitemaps can be compressed using gzip.
  • A Sitemap can be contain a list of Sitemaps (a Sitemap index file serving as an entry point for no more than 50,000 Sitemaps)

Submitting Your Sitemap to Search Engines

There are different ways to submit your Sitemap to search engines:

1. Adding the following line to your robots.txt file

Sitemap: <sitemap_location>

The <sitemap_location> should be the complete URL to the Sitemap, such as http://www.yourdomain.com/sitemap.xml

2. Submitting directly to a search engine (aka. pinged)

  • Google – http://www.google.com/webmasters/tools/ping?sitemap=location
  • Yahoo! – http://search.yahooapis.com/SiteExplorerService/V1/ping?sitemap=location
  • Ask.com – http://submissions.ask.com/ping?sitemap=location
  • Live Search – http://webmaster.live.com/ping.aspx?siteMap=location

Replace location with the complete URL to your Sitemap, such as http://www.yourdomain.com/sitemap.xml

For example, http://www.google.com/webmasters/tools/ping?sitemap= http://www.yourdomain.com/sitemap.xml

Additional References

Comments

comments