Sitemap files are XML documents that contain URLs for the pages of your site. A simple sitemap file would look similar to this:
<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url> <loc>http://www.example.com/</loc> </url> <url> <loc>http://www.example.com/contact/</loc> </url> </urlset>
Each <url>
tag is used to specify the URL of a single page. This tag has several child tags:
<loc>
is a required tag that specifies the actual URL. Note that the value of a<loc>
tag must begin with the protocol (such ashttp
) and end with a trailing slash, if your web server requires it. This value must be less than 2,048 characters long.<lastmod>
is an optional tag for specifying the date the page was last modified.<changefreq>
is an optional tag that indicates how often the page is likely to change.<priority>
is an optional tag that assigns a priority value to the page, relative to other pages on the site.
For more information about these tags, see:
http://www.sitemaps.org/protocol.php
Sitemap Indexes
A single site can have more than one sitemap. Using multiple sitemaps can help make your sitemaps more manageable; for example, you can have a separate sitemap for each area of a site. On very large sites, having multiple sitemaps may be necessary to ensure that no individual sitemap exceeds the maximum file size (10 Mb or 50,000 URLs).
To use multiple sitemaps, you list them all in an XML file called a sitemap index. For example:
<?xml version="1.0" encoding="UTF-8"?> <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <sitemap> <loc>http://www.example.com/sitemap.xml</loc> </sitemap> <sitemap> <loc>http://www.example.com/sitemap2.xml</loc> </sitemap> </sitemapindex>
The <loc>
tag is a required child tag of the <sitemap>
tag; it specifies the URL of a sitemap file. The <sitemap>
tag also has an optional <lastmod>
child tag that specifies the date the sitemap file was last modified.