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, allowing Google to find your essential 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 essential 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 important page of your website. But sometimes, pages end up without internal links pointing to them, making them hard to find. A sitemap can help speed up content discovery.
Looking to expand your knowledge of technical SEO? We’ve just launched a new course in the Yoast SEO academy focusing on crawlability and indexability. One of the topics we tackle is how to properly use XML sitemaps.
What does an XML sitemap look like?
An XML sitemap offers a standardized way of listing posts and pages, making them discoverable for search engines. Here’s a very simple example, a sitemap with a single URL:
<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url> <loc>https://www.yoast.com/wordpress-seo/</loc> <lastmod>2022-01-01</lastmod> </url> </urlset>
It consists of a couple of parts:
- An XML version declaration: which search engine crawlers use to determine what type of file they are reading.
- The URL set: tells search engines about the protocol.
- The URL: lists the URL of the page.
- Lastmod: a date format describing when the page was last modified.
Every sitemap needs to follow this standard to be valid. There are other properties like <priority> and <changefreq> but these don’t have any effect on the workings or performance of the sitemap.
An example of an XML sitemap
Let’s take a look at an example. Below, you’ll see a screenshot of the base XML sitemap of yoast.com. In this sitemap, you see all the different sitemaps on yoast.com. 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 sitemap, Google knows new content exists to crawl and index.
As you can see, the Yoast.com XML sitemap shows several ‘index’ sitemaps:
video-sitemap.xml etc. This categorization makes a site’s structure as straightforward 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.
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 and can have a file size of up to 50MB, so if your website has more than 50,000 posts, 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,” “websites with large archives,” “new websites with just a few external links to it,” and “websites which use rich media content.” According to Google, proper internal linking should allow it to find all your content easily. Unfortunately, there are many sites out there that do not give proper thought to logically linking their content.
While we agree that these websites will 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 essential 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 don’t want that URL to appear 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: A new blog
Say, for example, you are starting a new blog. Of course, you want to ensure that your target audience can find your blog posts in the search results. So, it’s a good idea to immediately include your posts in your XML sitemap. It’s safe to assume that most of your pages will also be relevant results for your visitors. However, a thank you page that people will see after they’ve subscribed to your newsletter is not something you want to appear in the search results. In this case, you don’t want to exclude all pages from your sitemap but just this one.
Let’s stay with the example of the new blog. In addition to your blog posts, you create some categories and tags as well. These categories and tags will have archive pages that list all posts in that specific category or tag. However, in the beginning there might not be enough content to fill these archive pages, making them ‘thin content’. For example, tag archives that show just one post, are not that valuable to visitors yet. You can exclude them from the sitemap when you’re just starting out with your blog, and then include them once you have enough posts. You can even exclude all your tag pages or category pages at once, if you’re using Yoast SEO.
However, this kind of page could also be excellent ranking material. So, if you think: well, yes, this tag page is a bit ‘thin’ right now, but it could be a great landing page, then enrich it with additional information and images. And don’t exclude it from your sitemap in this case.
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. You can find your sitemaps in the ‘Sitemaps’ section. 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. Maybe there’s an error that prevents some pages from indexing? Another option is that you may need more links pointing to the content that’s not been indexed yet.
How to add XML sitemaps to your site with Yoast SEO
Because of their SEO value, we’ve added the ability to create your XML sitemaps in our Yoast SEO plugin. They are available in both the free and Premium versions of the plugin. We make them automatically for you, placing them in the right place. You don’t have to worry about where your XML sitemap should be placed and about optimizing them for search engines.
While we worked with Google to bring XML sitemaps natively to WordPress, we offer a superior version of sitemaps in Yoast SEO. The WordPress one is basic, 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:
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. You can also do this for individual posts and pages by going to the Advanced settings in the Yoast SEO meta box or sidebar and selecting an option in the ‘Allow search engines to show this Post/Page in search results?’
Read more about excluding content types here.
Frequently asked questions about XML sitemaps
There are a lot of questions regarding XML sitemaps, we’ve answered a couple in the FAQ below.
If the XML sitemap isn’t valid, or if it’s not being read correctly by search engines, you must find out what type of error is listed. If search engines aren’t reading the XML sitemap, ensure it’s submitted to the search engine webmaster tools. If it’s not valid, check the errors and make sure to find the specific solutions to your issue.
In most cases, you can find out if sites have an XML sitemap by adding sitemap.xml to a root domain. So, that would be example.com/sitemap.xml. If a site has Yoast SEO installed, you’ll notice that it’s redirected to example.com/sitemap_index.xml. Sitemap_index.xml is the base sitemap that collects all the individual sitemaps on your site on one page.
There are ways to make and update your sitemaps by hand, but we wouldn’t approve of that. Also, there are static generators out there that help you make a sitemap at any given moment. But, again, this process would need to repeat itself every time you add or update content. The best way to do this is by simply using Yoast SEO. Turn on the XML sitemap in Yoast SEO and site back — all your updates will automatically happen.
In the past, people were sure that adding the <priority> attribute to sitemaps would signal to Google that specific URLs would need to be prioritized by Google. Unfortunately, <priority> doesn’t do anything, as Google has often mentioned that they do not use this attribute to read and prioritize content found in the sitemaps.
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. If you add the correct URLs, Google can easily access your most important pages and posts. 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 check your 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!
Coming up next!
- Stay tuned Keep an eye on our site and social media to stay up-to-date. See where you can find us next »
- SEO webinar 20 December 2022 Our head of SEO, Jono Alderson, will keep you up-to-date about everything that happens in the world of SEO and WordPress. All Yoast SEO webinars »