How to Create an XML Sitemap for WordPress with Yoast

One of the many great things about the Yoast SEO plugin is that it automatically generates an XML sitemap when you install it.

However, this off-the-shelf sitemap needs a bit of configuration and customization to help search engines crawl and index the pages on your site you want appearing in search results.

Beyond creating your XML sitemap for you, Yoast gives you the ability to easily control what appears in it. Most importantly, it will allow you to exclude certain types of content you don’t want appearing in search results.

Let’s take a closer look at what XML Sitemaps are, why they are important, when you should use them and what you want to include in yours.

What is an XML Sitemap?

An XML sitemap is a list of important pages on your website. Let’s use our XML sitemap as an example.

XML Sitemap

As you can tell by the look and feel of it, an XML sitemap isn’t user-oriented.

Rather, it allows you to tell search engines what pages (URLs) you want crawled and indexed. It also tells them when you last updated those pages and how search engines should prioritize each page when crawling your site.

When you look closer at a sitemap like ours, you will see that it is actually an index of content type sitemaps.

Each content type sitemap organizes all the different URLS that are associated with that particular content type. Starting at the top of our sitemap index above, you can see it includes individual sitemaps for posts, pages, categories, post_tags, and authors.

You can click on any one of those individual sitemaps to see all the pages/URLS on our site associated with that particular content type.

When to Use an XML Sitemap in WordPress

A well structured WordPress website on its own is easy for the search engines to crawl and index. Hence the importance of good site structure in SEO.

Add a user-facing HTML sitemap to a well structured site and it makes it even easier for search engines. If your website has both of those things going for it, an XML sitemap becomes less important, but still recommended.

Think of your XML sitemap as your resume. You wouldn’t show up to an interview without a resume. You might still get the job without one, but it certainly doesn’t hurt to summarize your credentials in a structured, simple manner to make things easy on the company interviewing you. Your XML sitemap makes it easier for the search engines to do a good job crawling and indexing your website.

It will also allow you to create a direct line of communication with the search engines via Google Search Console and Bing Webmaster Tools.

How to Check Your XML Sitemap in WordPress

There are two places you will likely find your sitemap if you have one.

First, try appending /sitemap_index.xml to your homepage URL. If you see your sitemap, and you have Yoast SEO installed, your sitemap is being generated by Yoast. It also means you can skip ahead to the How to Edit an XML Sitemap in Yoast section below.

If appending /sitemap_index.xml doesn’t work, try appending /sitemap.xml to your homepage URL. If you see a sitemap, it means it means your XML sitemaps is likely being generated by another plugin.

If you don’t see anything when you try each of the above, or if you get a 404 error, we recommend you create a sitemap using Yoast SEO.

You can also use All in One SEO Pack, Google XML Sitemaps, or XML Sitemaps. However, this tutorial will only cover Yoast SEO, because it’s the most widely used and our preferred SEO plugin.

Overwhelmed by SEO? Try a guided approach.

How to Create an XML Sitemap in WordPress with the Yoast SEO Plugin

1. Log into your WordPress website.

2. In the left-hand menu, hover over the Yoast SEO plugin, and click on General. Then, navigate to the Features tab. If you don’t have the Yoast SEO Plugin, start by adding it to your website.

XML sitemap Yoast

3. As mentioned, the Yoast SEO plugin automatically creates an XML sitemap. Click on “See the XML Sitemap” to view your sitemap index.

Show XML sitemap

How to Edit an XML Sitemap with Yoast

1. By default, your XML sitemap will include most content types, each with its own individual sitemap in the XML sitemap index. Using Yoast, you have the ability to include or exclude these individual content type sitemaps from the index.

2. To include or exclude content type sitemaps from your sitemap index, go to Search Appearance in the Yoast SEO Plugin.

Search Appearance Yoast

3. Then, pull up your XML sitemap index and review each content type sitemap to decide if you want to keep it in the index. Ask yourself “Do I want search engines to show this type of content in search results?”

If you answer “Yes,” then keep those sitemaps in the index by leaving the “Show -------- in search results?” toggle switched to Yes for that particular content type in the Yoast plugin. If you answer “No” because you don’t want pages associated with that content type appearing in search results, then switch the toggle to No for that particular content type.

Exclude categories Yoast

NOTE: Notice that there are numerous tabs that appear at the top of the Search Appearance panel in the Yoast plugin i.e. General, Content Types, Media.... If you don’t see a content type you are looking to include/exclude in your sitemap, for example “pages” or “categories,” click between those tabs at the top until you find it.

4. Now go back to your XML sitemap index. It’s time to drill down into your content type sitemaps and review each of the pages/URLs in them.

Your goal is to include pages you do want search engines showing in search results and exclude pages you don’t want them showing.

Try to avoid including broken pages and pages with thin or duplicate content. Oftentimes, tag and category pages, and theme files, have thin content and can waste search engine crawler bandwidth.

You can exclude these individual pages by clicking “Edit Page” at the top of the page you want to exclude. Once in the page editor, navigate to the Yoast SEO metabox.

Click on the gear icon. Select No under “Allow search engines to show this Page in search results?” Click “Update” in the top right to save changes.

Exclude pages in Yoast

8. Refresh your XML sitemap and review one more time.

You now have the tools you need to tell search engines what pages on your site are important and what pages you don’t want to be included in their index and search results.

Get Your Free SEO Score

Find out how your site's SEO stacks up.

Erik Wardell

Erik Wardell

Erik is an SEO coach that loves breaking down complex SEO topics into understandable instructions anyone can follow. He thrives on helping people do what it takes to see their businesses succeed in search.