XML sitemaps in the Yoast SEO plugin

Having an XML sitemap can be beneficial for SEO, as Google can retrieve essential pages of a website very fast, even if the internal linking of a site isn’t flawless.

The sitemap index and individual sitemaps are updated automatically as you add or remove content and will include the post types you want search engines to index. Post Types marked as ‘noindex’ will not appear in the sitemap. To learn more about how to noindex see: How do I noindex URLs?

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

Table of contents

The XML sitemap feature

Follow these steps to enable the XML sitemaps feature:

  1. Log in to your WordPress website.

    When you’re logged in, you will be in your ‘Dashboard’.

  2. Click on ‘SEO’

    On the left-hand side, you will see a menu. In that menu, click on ‘SEO’

  3. Click on ‘General’.

    The ‘SEO’ settings will expand providing you additional options. Click on ‘General’.

  4. Click on the ‘Features’ tab.

    Admin SEO General Features

  5. Toggle the ‘XML Sitemaps’ switch.

    To enable the feature, toggle the switch to ‘On’.
    To disable the feature, toggle the switch to ‘Off’.

  6. Click ‘Save Changes’

View the sitemap

  1. Log in to your WordPress website.
    When you’re logged in, you will be in your ‘Dashboard’.
  2. Click on ‘SEO’.
    On the left-hand side, you will see a menu. In that menu, click on ‘SEO’
  3. Click on ‘General’.
    The ‘SEO’ settings will expand providing you additional options. Click on ‘General’.
    Admin SEO General
  4. Click on the ‘Features’ tab.
    Admin SEO General Features
  5. Click the question mark for the XML Sitemap feature.
  6. Click ‘See the XML sitemap.’

Limit the number of sitemap entries

You can limit the number of sitemap entries by using the filter wpseo_sitemap_entries_per_page. Here follows example code to limit the max entries to 100. If you are not sure where it would go or how to add this code, we suggest working with a Yoast Partner here who can help.

<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/

/* Limit the number of sitemap entries for Yoast SEO
 * Credit: Yoast Developers
 * Last Tested: Jan 31 2019 using Yoast SEO 9.5 on WordPress 5.0.3
 * Yoast SEO defaults to 1000
 * Google allows up to 50000 URLs or 50MB (uncompressed)
 */
function max_entries_per_sitemap() {
    return 100;
}

add_filter( 'wpseo_sitemap_entries_per_page', 'max_entries_per_sitemap' );

Add an external sitemap

Want to add an external sitemap? Use this guide.

Can I change the sitemap priority?

We’ve decided to remove the priority variables from our XML sitemaps in the 3.5 version of Yoast SEO, as Google has said publicly that they don’t use them on most sites.

Are you having issues with your sitemap?

Maybe you need a different guide after enabling the sitemap. Is your sitemap not updating? Do you wonder why it shows grey links? Is your sitemap a blank page? Or are you looking for common XML sitemap errors? You can also use our search bar at the top to search for your specific issue.

If you have a sitemap that is located on example.com/sitemap.xml, your sitemap is not being generated by our Yoast SEO plugin. It is probably generated by Google XML Sitemaps or another XML sitemaps plugin. Please disable other sitemap plugins and remove any sitemap files via FTP before enabling the sitemaps in our plugin.