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

A good XML sitemap acts as a roadmap of your website that leads Google to all your important pages. XML sitemaps can be good for SEO, as they allow Google to find your essential website pages quickly, 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?

An XML sitemap is a file that lists a website’s important pages, making sure Google can find and crawl them all. It also helps search engines understand your website structure. You want Google to crawl every essential page of your website. But sometimes, pages end up without any internal links pointing to them, making them hard to find. A sitemap can help speed up content discovery.

a screenshot showing the xml sitemap on yoast.com
Yoast.com’s XML sitemap

Above is Yoast.com’s sitemap, created by the Yoast SEO plugin. Further down this page, we’ll explain how our plugin helps you make the best XML sitemaps. If you don’t use our plugin, your sitemap may look slightly 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.

an image of the post XML sitemap on yoast.com
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 huge 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 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.”

While we agree that these kinds of websites will definitely benefit the most from having one, at Yoast, we think XML sitemaps are beneficial for every website. Every single website needs Google to be able to find the most important pages easily and to know when they’re last updated. That’s 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’ tag. Leaving it out of your 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 recent posts quickly to make sure your target audience can find your blog in the search results, so it’s a good idea to create an XML sitemap right from the start. You might make 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 they 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’ 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 ‘Sitemaps’ section, you’ll immediately see if your XML sitemap is already added. If not, you can add your sitemap at the top of the page.

Adding your sitemap helps to check whether Google indexed all pages in your sitemap. 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. Another option is, that you may need more links pointing to the content that’s not been indexed yet.

An image showing Google Search Console discovered the posts in the XML sitemap
Google correctly processed all URLs in our post sitemap

How to add XML sitemaps to your site with Yoast SEO

Because of their SEO value, 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. We create them automatically for you and we place them in the right place. You don’t have to worry about the question of where your XML sitemap should be placed.

While we worked together with Google to bring XML sitemaps natively to WordPress, we offer a superior version of sitemaps in Yoast SEO. The WordPress one is basic and not nearly as fine-tuned and fully featured as the one in Yoast SEO. If you install Yoast SEO, we automatically disable the WordPress sitemap for you.

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:

An image showing the sitemap setting in Yoast SEO
You can find the XML sitemaps in the Features tab of Yoast SEO
Click on the link to see the XML sitemap of your site

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.

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?’, this type of content won’t be included.

Determine what you want to see in the XML sitemap

Read more about excluding content types here.

Check your own XML sitemap!

Now, you know how important it is to have an XML sitemap: having one can help your site’s SEO. Google can easily access your most important pages and posts if you add the right URLs to them. Google will also 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 allows you to check for sitemap errors.

So make sure to check your own XML sitemap and find out if you’re doing it right!

Assess your technical SEO fitness

Having a good XML sitemap is part of your technical SEO. Curious how fit your site’s overall technical SEO is? We’ve created a technical SEO fitness quiz that helps you figure out what you need to work on!


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

  1. sucheta shukla
    sucheta shukla  • 1 month ago

    Excellent article on sitemap. This is useful for every wordpress users.

    • Amy Lees
      Amy Lees  • 1 month ago

      Hi Sucheta, thanks for the positive feedback! If you’re interested in the technical aspects of SEO, maybe you’d like to check out our Technical SEO Fitness Quiz.

  2. Gomes
    Gomes  • 1 month ago

    My sitemap does not load anything, is simply blank. I’ve created it using the Yoast SEO plugin. Even so I’ve linked that o Google Search Console (for the first time, it is a new site), but I don’t know if it’s will works. Is there any error on my blank sitemap (i am begginer)? Any suggestion?

  3. alexsander
    alexsander  • 1 month ago

    I’m a Yoast user but recently had a problem URL
    Indexed, not submitted in sitemap in GSC.
    in this case, I can see my URL included in the post-sitemap.xml. Please help my problem
    Big thanks

  4. Usha
    Usha  • 1 month ago

    Please help me how to change my posts from HTML to XML in google search console. I am getting error in google search console.

    • Camille Cunningham
      Camille Cunningham  • 1 month ago

      Hi there, Usha! I’m not quite sure what you mean, could you elaborate?

  5. Ahsan Ali
    Ahsan Ali  • 1 month ago

    Good Info about XML sitemap. I am begginer

    • Camille Cunningham
      Camille Cunningham  • 1 month ago

      Hi Ahsan, thanks for your comment! If you’re new to SEO, our articles on the SEO Basics might be very helpful :) Good luck!