What is an XML sitemap and why should you have one?

A good XML sitemap acts as a roadmap of your website which leads Google to all your important pages. XML sitemaps can be good for SEO, as they allow Google to quickly find your essential website pages, even if your internal linking isn’t perfect. This post explains what they are and how they help you rank better.

What are XML sitemaps?

You want Google to crawl every important page of your website, but sometimes pages end up without any internal links pointing to them, making them hard to find. An XML sitemap lists a website’s important pages, making sure Google can find and crawl them all, and helping it understand your website structure:

XML sitemap Yoast

Yoast.com’s XML sitemap

Above is Yoast.com’s XML sitemap, created by the Yoast SEO plugin and later on we’ll explain how our plugin helps you create the best XML sitemaps. If you’re not using our plugin, your sitemap may look a little different but will work the same way.

As you can see, the Yoast.com XML sitemap shows several ‘index’ sitemaps: …/post-sitemap.xml, …/page-sitemap.xml, …/video-sitemap.xml etc. This categorization makes a site’s structure as clear as possible, so if you click on one of the index sitemaps, you’ll see all URLs in that particular sitemap. For example, if you click on ‘…/post-sitemap.xml’ you’ll see all Yoast.com’s post URLs (click on the image to enlarge):

XML Post Sitemap Yoast

Yoast.com’s post XML sitemap

You’ll notice a date at the end of each line. This tells Google when each post was last updated and helps with SEO because you want Google to crawl your updated content as soon as possible. When a date changes in the XML sitemap, Google knows there is new content to crawl and index.

If you have a very large website, sometimes it’s necessary to split an index sitemap. A single XML sitemap is limited to 50,000 URLs, so if your website has more than 50,000 posts, for example, you’ll need two separate ones for the post URLs, effectively adding a second index sitemap. The Yoast SEO plugin sets the limit even lower – at 1.000 URLs – to keep your sitemap loading as fast as possible

What websites need an XML sitemap?

Google’s documentation says XML sitemaps are beneficial for “really large websites”, for “websites with large archives”, for “new websites with just a few external links to it” and for “websites which use rich media content”.

Here at Yoast, while we agree that these kinds of websites will definitely benefit the most from having one, we think XML sitemaps are beneficial for every website. Every single website needs Google to be able to easily find the most important pages and to know when they were last updated, which is why this feature is included in the Yoast SEO plugin.

Which pages should be in your XML sitemap?

How do you decide which pages to include in your XML sitemap? Always start by thinking of the relevance of a URL: when a visitor lands on a particular URL, is it a good result? Do you want visitors to land on that URL? If not, it probably shouldn’t be in it. However, if you really don’t want that URL to show up in the search results you’ll need to add a ‘noindex, follow’ tag. Leaving it out of your XML sitemap doesn’t mean Google won’t index the URL. If Google can find it by following links, Google can index the URL.

Example 1: A new blog

Say, for example, you are starting a new blog. You will want Google to find new posts quickly to make sure your target audience can find your blog on Google, so it’s a good idea to create an XML sitemap right from the start. You might create a handful of first posts and categories for them as well as some tags to start with. But there won’t be enough content yet to fill the tag overview pages, making them “thin content” that’s not valuable to visitors – yet. In this case, you should leave the tag’s URLs out of the sitemap for now. Set the tag pages to ‘noindex, follow’ because you don’t want people to find them in search results.

Example 2: Media and images

The ‘media’ or ‘image’ XML sitemap is also unnecessary for most websites. This is because your images are probably used within your pages and posts, so will already be included in your ‘post’ or ‘page’ sitemap. So having a separate ‘media’ or ‘image’ sitemap would be pointless and we recommend leaving it out. The only exception to this is if images are your main business. Photographers, for example, will probably want to show a separate ‘media’ or ‘image’ XML sitemap to Google.

How to make Google find your sitemap

If you want Google to find your XML sitemap quicker, you’ll need to add it to your Google Search Console account. In the new Search Console, you can find the sitemaps in the ‘Index’ tab. You’ll immediately see if your XML sitemap is already added to Search Console. If not, you can add your sitemap on top of the page:

Add sitemap index to Search Console

Yoast.com’s XML sitemap added to the new Google Search Console

Within the old Google Search Console you can see your sitemaps by navigating to ‘Crawl’ and then clicking on ‘Sitemaps’.  Click on the ‘Add/Test sitemap’ button which you see on the right of the arrow in the image below if you haven’t added your XML sitemap.

Google Search Console XML Sitemap Yoast

Yoast.com’s XML sitemap added to the old Google Search Console

As you can see in the image, adding your XML sitemap can be helpful to check whether all pages in your sitemap really have been indexed by Google. If there is a big difference in the ‘submitted’ and ‘indexed’ number on a particular sitemap, we recommend looking into this further. There could be an error preventing some pages from being indexed or maybe you need more content or links pointing to the content that’s not been indexed yet.

Yoast SEO and XML sitemaps

Because they are so important for your SEO, we’ve added the ability to create your own XML sitemaps in our Yoast SEO plugin. They are available in both the free and premium versions of the plugin.

Yoast SEO creates an XML sitemap for your website automatically. Click on ‘SEO’ in the sidebar of your WordPress install and then select the ‘Features’ tab:

XML sitemaps in Yoast SEO

In this screen, you can enable or disable the different XML sitemaps for your website. Also, you can click on the question mark to expand the information and see more possibilities, like checking your sitemap in your browser:
XML Sitemaps

You can exclude content types from your XML sitemap in the ‘Search Appearance’ tab. If you select ‘no’ as an answer to ‘show X in the search results?’ then this type of content won’t be included in it.

Read more about excluding content types here.

Check your own XML sitemap!

Now you’ve read the whole post, you know how important it is to have an XML sitemap, because having one can really help your site’s SEO. Google can easily access your most important pages and posts if you add the right URLs to it. Google will also be able to find updated content easily, so they know when a URL needs to be crawled again. Lastly, adding your XML sitemap to Google Search Console helps Google find your sitemap fast and it allows you to check for sitemap errors.

Now go check your own XML sitemap and make sure you’re doing it right!

Read more: WordPress SEO tutorial: definite guide to higher ranking »

Improve your technical SEO skills!

  • Which technical SEO errors hurt your site?
  • Solve them and climb the rankings!
  • Improve your site speed on the go
  • On-demand SEO training by Yoast
More info

17 Responses to What is an XML sitemap and why should you have one?

  1. Ravina Gupta
    Ravina Gupta  • 2 months ago

    Its very useful article on XML Sitemap.
    How to generate manual XML sitemap in html site?

  2. catpl
    catpl  • 2 months ago

    XML sitemap is very important for every website because xml sitemap is search engine friendly and easily cawed by the search engines.

  3. Tradewell Securities
    Tradewell Securities  • 2 months ago

    Hi,
    Now i get importance of XMLsitemap to a website. XML sitemap is helpful to crawl and index our website.
    its really useful information to develop my website. Thanks for sharing this.

  4. MIMIT,Malout
    MIMIT,Malout  • 2 months ago

    Thanks for sharing this wonderful information. It helped me a lot while doing digital marketing’s exam preparation. Keep posting this amazing stuff.

  5. Vinayaka
    Vinayaka  • 2 months ago

    Really great Article.very helped me to know about XML sitemap.
    Thanks for this.Please share like this post!!

  6. Raj
    Raj  • 2 months ago

    Now I get what an XML map is. It’s really very helpful in SEO, I must say, people ignore it many times. Thanks to Yoast SEO they let us create our own XML. I am doing SEO of one of my clients. and i will definitely use this XML mapping

  7. WordPress PlugIn Development India
    WordPress PlugIn Development India  • 2 months ago

    Great and really essential post. I came to know a lot about this new concept. It seems that XML sitemap is an important concept for our SEO or we can say that it is a kind of roadmap of our site through which we can instruct Google to find our some important pages or blogs or many more. Thanks for sharing this informative post.

    • Iris Guelen
      Iris Guelen  • 2 months ago

      You definitely got that right! And, happy we could be of help :)

  8. NetSocialBlog
    NetSocialBlog  • 2 months ago

    The importance of Sitemap XML cannot be underestimated.. Apart from helping Google to crawl one’s site faster..
    It also helps one to know whenever one of the post link is broken or something is wrong

    • Iris Guelen
      Iris Guelen  • 2 months ago

      It is indeed very handy in many ways!

  9. Dentist
    Dentist  • 2 months ago

    Why can’t my geo-sitemap.xml be indexed by google?

  10. Luc van Gerrevink
    Luc van Gerrevink  • 2 months ago

    If you changed the content of a blog or page and you want google to index the new blog or page as fast as possible, what do you advise as the best way to make google aware of the change?

  11. Megan McDonald
    Megan McDonald  • 2 months ago

    I have recently been asked by a client ( via their SEO people) to add some code to the robots.txt file.

    ” (https://xxxxxx.com/robots.txt) does not contain a link
    to your sitemap. Listing the link to your sitemap will
    make it easier for Google to find the sitemap file.”
    “The sitemap file will then help the search engines crawl
    your website easily and be able to index more pages,
    therefore, update our work.”
    “Please insert into the robots.txt file the sitemap
    reference code below:
    Sitemap: https://xxxxxx.com/sitemap_index.xml

    Is it really necessary if a yoast created sitemap has already been submitted via google console?

  12. Friendscy
    Friendscy  • 2 months ago

    Asuming i submitted sitemap.xml in my google search console, do i still need to submite sitemaps like “post_sitemap.xml”

  13. Ariel Caruso
    Ariel Caruso  • 2 months ago

    Buenos días, utilizando el complemento de yoast para generar mi XML, encuentro muchísimos errores de cobertura con páginas que yo no he creado. Me pregunto qué serán, quien las crea y cómo poder evitarlas. Dejo aquí algunos ejemplos:

    /wp-includes/Requests/Exception/HTTP/405.php
    wp-includes/Requests/Exception/HTTP/410.php
    wp-includes/Requests/Exception/HTTP/428.php

    Por otro lado he tenido innumerables cantidades de errores 410, en los cuales clickeo sobre la URL y la imagen abre.

    Podría asesorarme?

    Muchas gracias.

  14. Mathukutty P. V,
    Mathukutty P. V,  • 2 months ago

    I am using Yoast xml site map submitted to search console, bing, yandex.

  15. Richard
    Richard  • 2 months ago

    Plain text sitemaps are far easier to work with:
    Example: https://www.rgraph.net/sitemap.txt
    Docs: https://support.google.com/webmasters/answer/183668?hl=en


Check out our must read articles about Google Search Console