Bringing it all together

You should include all relevant XHTML, image, and video elements within their corresponding <url> tag.

For instance, /foo.html contains one image and a mobile alternate, a regional alternate, and a regional mobile alternate, /foo-two.html has two regional alternates and a video.

<?xml version=“1.0” encoding=“UTF-8”?>
<urlset xmlns=“http://www.sitemaps.org/schemas/sitemap/0.9” xmlns:xhtml=“http://www.w3.org/1999/xhtml” 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>
    <lastmod>2013-08-19T19:22:58+00:00</lastmod>
    <changefreq>weekly</changefreq>
    <priority>0.6</priority>
    <xhtml:link rel=“alternate” media=“(max-width: 640px)” href=“http://mobile.example.com/ foo.html” />
    <xhtml:link rel=“alternate” hreflang=“de” href=“http://www.example.com/de/foo.html” />
    <xhtml:link rel=“alternate” hreflang=“de” media=“(max-width: 640px)” href=“http://mobile.example.com/de/foo.html” />
    <image:image> 
        <image:loc>http://images.example.com/waterfall.jpg</image:loc>
        <image:caption>Waterfall in Niagara</image:caption>
    </image:image>
</url>

<url>
    <loc>http://www.example.com/foo-two.html</loc>
    <lastmod>2013-12-04</lastmod>
    <changefreq>yearly</changefreq>
    <priority>0.1</priority>
    <xhtml:link rel=“alternate” hreflang=“de” href=“http://www.example.com/de/foo-two.html” />
    <xhtml:link rel=“alternate” hreflang=“nl-be” href=“http://www.example.be/nl/foo-two.html” />
    <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</video:title>
        <video:description>Get perfectly done steaks every time</video:description>
    </video:video>
</url>

</urlset>

Acceptable Date Values

Anywhere a date is used in an XML sitemap, it should be in the format ‘YYYY-MM-DDThh:mm:ss+TZD’ (the time is optional)

Valid examples:

  • 2014-07-16T19:20:30+08:00
  • 2014-07-16

Maximum Entries

XML sitemaps are limited to 50, 000 URLs each (or 10MB when decompressed) – when sitemaps reach more than this you should segment them by the sections of your site or into 50k/10MB segments, then reference them all in a sitemap index file (which then gets submitted to search engines and included in the robots.txt).