Skip to content

XML Sitemap

By Matthew Edgar · Last Updated: February 17, 2023

An XML Sitemap lets you share data about the pages on your website with search engines. By doing so, search engines gain a deeper understanding of which pages exist on your website that they could possibly include in the search results. XML sitemaps can help search engines identify which pages to crawl and can also help establish the canonical version of URLs.

There are also specific XML sitemap formats for news, images, and videos. These can be especially helpful if your website relies heavily on that type of content. For example, if you regularly share videos on your website, having a video XML sitemap can make it easier for search engines to index those videos.

Example XML Sitemap

Here is an example entry from an XML sitemap. A statement like this will exist for each page listed in your website’s XML sitemap.

<url>
<loc>https://www.site.com</loc>
<lastmod>2023-02-15</lastmod>
<changefreq>monthly</changefreq>
<priority>1.0</priority>
</url>

The <url> tag opens a new block of information about a specific URL and </url> closes that block of information. All the tags nested within the <url> tag share information about one particular page on the website. The only required element is the URL to the page, which is stated in between the <loc> and </loc> tags. In this case, the URL indicates the home page of site.com.

All the other data within the same <url> tags relate to that page. In this example, the optional fields indicate the date the page was last modified (<lastmod>), state how frequently the page changes (<changefreq>), and what priority to give this page (<priority>. While Bing’s developer notes seem to suggest they use these fields, it is worth noting that per Google ignores priority and changefreq entries.

Image XML Sitemap

Images contained on a page can also be listed in the XML sitemap within the <url> tag. Information about the image is contained within the <image:image> tag and within that tag, the image URL is stated in the <image:loc> tag.

For example, here is the XML sitemap entry for Elementive’s about page listing the headshot images that are on this page. Note that there are two images on this page.

<url>
<loc>https://www.elementive.com/about-elementive/</loc>
<image:image>
<image:loc>https://www.elementive.com/data/uploads/Matthew-Edgar.jpg</image:loc>
</image:image>
<image:image>
<image:loc>https://www.elementive.com/data/uploads/Andrea-Streff.jpg</image:loc>
</image:image>
</url>

Video XML Sitemap

Similar to images, videos can also be listed on an XML sitemap. Information about any video contained a page can be listed within that page’s <url> tag inside a <video:video> tag. For the video, Google requires that information is provided for the video’s thumbnail, title, description, and a link to either the video itself or the video player.

For example, here is an example sitemap entry with information provided about a video contained on the example page:

<url>
<loc>https://www.site.com/some-page/</loc>
<video:video>
<video:content_loc>https://www.site.com/video/myvideo.mp4</video:loc>
<vide:thumbnail_loc>https://www.site.com/video/myvideo_thumb.jpg</video:thumbnail_loc>
<video:title>A Great Video</video:title>
<video:description>Quick summary of video</video:description>
</video:video>
</url>

URLs to Include in the XML Sitemap

The biggest mistake made when building an XML sitemap file is including pages you don’t want Google to crawl, index, or rank. This includes:

  • Error URLs (pages that return a 404, 410, or a 5xx error)
  • Redirected URLs
  • URLs containing low-quality content
  • Duplicate content
  • URLs that have a noindex tag
  • URLs that are blocked from crawling (either in the robots.txt file or via a meta tag)
  • Non-canonical versions of URLs (for example, don’t list http:// URLs when your website forces https://)

You want to regularly prune your XML sitemap file to check for these types of pages and remove these pages from your XML sitemap. As much as possible, these checks should be automated. For example, when a page is deleted from the website, it should automatically be removed from the XML sitemap.

By keeping your XML sitemap free of these types of issues, Google will more regularly crawl and rely on the XML sitemap to discover pages contained on your website.

Submit XML Sitemap In Google Search Console

After creating the XML sitemap, you want to tell Google and Bing about your new sitemap. The easiest way is to submit your XML sitemap directly to Google and Bing via Google Search Console and Bing Webmaster Tools.

In the Google Search Console sidebar menu, go to the “Index” section and then click on “Sitemaps”.

Sitemaps in Google Search Console

On the Sitemaps page, you will see a form to Add a new sitemap. Enter the URL to your XML sitemap, then click “Submit.” Following this, Google will begin reviewing your XML sitemap.

add xml sitemap in google search console

You can check back to this same page later to see if Google has detected any errors with your XML sitemap. On the main list of XML sitemaps submitted, you’ll see when the sitemap was submitted, when Google last read the sitemap, if Google was successful in reading the XML sitemap, and how many URLs were discovered on the sitemap file.

list of xml sitemaps in google search console

You can click on any of these XML sitemaps to view more details, including any details about errors that exist within this XML sitemap file.

Google Search Console - XML sitemap details

From the details page, you can also click to “See Page Indexing”. This will show you Google Search Console’s Page Indexing report specifically for URLs contained in this XML sitemap file. On this report, you can see any URLs on this XML sitemap that are not indexed due to an error or a warning, including errors, duplicate content, or redirected URLs.

Submit XML Sitemap In Bing Webmaster Tools

In Bing Webmaster Tools, navigate to Sitemaps in the sidebar. After arriving on the sitemap page, click on “Submit Sitemap” in the upper right corner. click submit. On the form that opens in the modal, enter the URL for your website’s XML sitemap. Once submitted, Bing will then crawl through your XML sitemap. You can check back to this same page later to see if Bing has detected any errors with your XML sitemap.

Upload XML sitemap to Bing

List XML Sitemap on Robots.txt

Another way to notify robots about the website’s XML sitemap is to list the XML sitemap on your robots.txt file. This is not officially supported but can be helpful if you are unable to submit the sitemap to Google Search Console or Bing Webmaster Tools. For example, here is the XML sitemap directive on Elementive’s robots.txt file:

Sitemap: http://www.elementive.com/sitemap.xml

Additional Resources

Need Help?

Want help with your website’s XML sitemap or improving your website’s other technical SEO factors? Contact me today.

Prefer a more DIY approach? Order my book, Tech SEO Guide, a reference guide to help you address the technical SEO  issues on your website. Order now on Amazon.

You may also like

How to Check HTTP Response Status Codes

Every page on every website returns an HTTP response status code. How do you check the status code for your website’s pages? What tools can you use to test status codes? What do the status codes mean?

Noindex vs. Nofollow vs. Disallow

Are you confused about the difference between noindex, nofollow and disallow commands? All three are powerful tools to use to improve a website’s organic search performance, but each has unique situations where they are appropriate to apply.

How to Use a Headless Browser

Learn what a headless browser is, why you should use a headless browser and how to launch a headless browser on your own computer.