sitemap.xml

December 30, 2011

What is it, and why do I need it?

A Sitemap is an XML file that lists URLs for a site, along with additional metadata about each URL, so that search engines can more intelligently crawl the site. [sitemaps.org]

Building and maintaining a sitemap file will allow search engines to learn about these urls easier. Having a proper sitemap.xml in conunction with a robots.txt file on your webserver will give you the best control of how search engines index your website. This, in turn, could improve ranking.

How do I make one?

The following is a sitemap for example.com, its product page, and its news page:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
   <loc>http://www.example.com/</loc>
   <lastmod>2011-01-01</lastmod>      <!-- optional -->
   <changefreq>monthly</changefreq>   <!-- optional -->
   <priority>0.8</priority>           <!-- optional -->
  </url>
  <url>
   <loc>http://www.example.com/products/</loc>
   <changefreq>weekly</changefreq>    <!-- optional -->
  </url>
  <url>
   <loc>http://www.example.com/news/</loc>
   <changefreq>hourly</changefreq>    <!-- optional -->
  </url>
</urlset>

Advanced sitemap.xml

Have multiple sitemaps to submit? You can address this two ways. Either by declaring the multiple sitemap paths in the robots.txt file, or by creating a sitemap index as indicated in the following:

<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <sitemap>
   <loc>http://www.example.com/sitemap_1.xml.gz</loc>
   <lastmod>2011-01-01</lastmod>      <!-- optional -->
  </sitemap>
  <sitemap>
   <loc>http://www.example.com/sitemap_2.xml.gz</loc>
   <lastmod>2011-01-01</lastmod>      <!-- optional -->
  </sitemap>
</sitemapindex>

seo

Previous Post

Next Post