Build a sitemap

You can choose from a variety of approaches to building your sitemap. The standard way to build a sitemap is to make an XML file; although, you can also use one of the alternative methods discussed later in this document. You also have the option to create your sitemap manually or, alternatively, you can choose from a number of third-party tools to generate your sitemap automatically. After you make your sitemap, you can later submit it to Google with the Sitemaps page.

An example of a simple XML sitemap that includes the location of a single URL is as follows. To learn about any the urlset, url, or loc XML tags, see the Sitemap tags reference table below.


<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> 
  <url>
    <loc>http://www.example.com/foo.html</loc> 
  </url>
</urlset>

Key guidelines for making an XML sitemap that can be read by Google are as follows, grouped by category:

  • Sitemap considerations

    • Include the following XML namespace declaration in your file: xmlns= http://www.sitemaps.org/schemas/sitemap/0.9.
    • Use consistent syntax for listing your URLs. For instance, if you list your home page URL as http://www.example.com/, your sitemap should not have URLs that begin with http://example.com/
    • Don't include session IDs from URLs in your sitemap to reduce duplicate crawling of those URLs.
    • Point out translated versions of a URL to Google for crawling and indexing by listing the unique URLs of each language in your sitemap file and by using hreflang annotations.
    • Sitemap files must be UTF-8 encoded, and URLs escaped appropriately.
  • Multiple sitemaps

    • Break up a large sitemap into a set of smaller sitemaps to prevent your server from being overloaded by serving a large file to Google. A sitemap file can't contain more than 50,000 URLs and must be no larger than 50 MB uncompressed.
    • Use a sitemap index file to list all your sitemaps and submit this single file to Google rather than submitting individual sitemaps.
  • Other considerations

    • Use recommended canonicalization methods to tell Google, if your site is accessible on both the www and non-www versions of your domain, the version of your domain that yous submitted a sitemap for (you only need one sitemap in this case).
    • Familiarize yourself with our Webmaster Guidelines, and our SEO Starter Guide if you're considering hiring a consultant to help you optimize your sitemaps. It can also be useful to check with colleagues with similar sites or businesses to get the most of your sitemap.

Sitemap extensions (video, images, news ...)

As well as basic URL information, sitemaps can contain detailed information about specific types of content on your site, including video, images, mobile, and news content. You can indicate content types to using the namespaces in the table below. Depending on the content types listed in your sitemap, you should specify namespaces accordingly.

General URL

xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"

Images

xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"

Video

xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"

Mobile

xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0"

News

xmlns:news="http://www.google.com/schemas/sitemap-news/0.9". However, Google recommends that you create separate a sitemap for your news content. Google crawls news sitemaps more frequently to check for new news articles. More information about news sitemaps.

Another example of an XML sitemap is as follows, with image and video information in addition to the single URL entry from the previous example. See the reference table below (sitemap tag definitions) for more details about the XML tags for URLs.

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" 
  xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" 
  xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
  <url> 

    <loc>http://www.example.com/foo.html</loc> 
    <image:image>
       <image:loc>http://example.com/image.jpg</image:loc> 
    </image:image>

    <video:video>     
      <video:content_loc>
        http://www.example.com/video123.flv
      </video:content_loc>
      <video:player_loc allow_embed="yes" autoplay="ap=1">
        http://www.example.com/videoplayer.swf?video=123
      </video:player_loc>
      <video:thumbnail_loc>
        http://www.example.com/thumbs/123.jpg
      </video:thumbnail_loc>
      <video:title>Grilling steaks for summer</video:title>  
      <video:description>
        Cook the perfect steak every time.
      </video:description>
    </video:video>

  </url>
</urlset>
Note that for simplicity, only a subset of available video tags are shown in this example—you can learn more in the following article on video sitemaps. You can also see more image tags in the image sitemaps article.

Sitemap tag definitions

The following table outlines all the tags required for sitemaps that list web URLs. To add more detailed information about specific content types, see video, images, mobile, and news.

Tag

Required?

Description

<urlset> Required Encloses all information about the set of URLs included in the sitemap.
<url> Required Encloses all information about a specific URL.
<loc> Required Specifies the URL. For images and video, specifies the landing page (aka play page).
<lastmod> Optional Shows the date the URL was last modified, in YYYY-MM-DDThh:mmTZD format (time value is optional).
<changefreq> Optional Provides a hint about how frequently the page is likely to change. Valid values are:
  • always. Use for pages that change every time they are accessed.
  • hourly
  • daily
  • weekly
  • monthly
  • yearly
  • never. Use this value for archived URLs.
<priority> Optional Describes the priority of a URL relative to all the other URLs on the site. This priority can range from 1.0 (extremely important) to 0.1 (not important at all).
Note that the priority tag does not affect your site ranking in Google search results. Priority values are only considered relative to other pages on your site so, assigning a high priority (or specifying the same priority for all URLs) will not boost your entire site search ranking.


In addition to the standard XML format, Google also accepts the following file types as sitemaps:

  • RSS, mRSS, and Atom 1.0: If you have a blog with an RSS or Atom feed, you submit the feed's URL as a sitemap. Most blog software is able to create a feed for you, but recognize that this feed only provides information on recent URLs.
    • Google accepts RSS (Real Simple Syndication) 2.0 and Atom 1.0 feeds.
    • You can use an mRSS (media RSS) feed to provide Google details about video content on your site.
  • Text file: For basic sitemaps that include only web page URLs, you can provide Google with a simple text file that contains one URL per line. For example: 
        http://www.example.com/file1.html
        http://www.example.com/file2.html
    • For best results, use the following guidelines for creating text file sitemaps:
      • You must fully specify all URLs in your sitemap as Google attempts to crawl them exactly as you list them.
      • Your text file must use UTF-8 encoding.
      • Your text file should contain nothing but the list of URLs.
      • You can name the text file anything you wish, provided it has a .txt extension (for instance, sitemap.txt).
  • Google Sites sitemap: If you've created and verified a site using Google Sites, we automatically generate a sitemap for you. You can then take this sitemap and submit it to Google Note, your sitemap might not be displayed properly if you have more than 1,000 pages in a single sub-directory.

    • If your site is hosted at Google Sites, and your site domain is located at the URL http://sites.google.com/yoursitename for example, your sitemap URL is http://sites.google.com/site/yoursitename/system/feeds/sitemap

    • If you created your site using Google Apps, your sitemap URL is http://sites.google.com/yourdomain/yoursitename/system/feeds/sitemap

Once you've made your sitemap, you can then submit it to Google with the Sitemaps page, or by inserting the following line anywhere in your robots.txt file:

Sitemap: http://example.com/sitemap_location.xml

 

Was this article helpful?