How to Customize the Sitemap Index

Last update: 17 January, 2017

The sitemap index includes links to a variety of sub-sitemaps for posts, pages, authors, categories, tags, and other taxonomies. The sitemap index can be customized under SEO > XML Sitemaps.

1
Log in to your WordPress website. When you're logged in, you will be in your 'Dashboard'. On the left-hand side, you will see a menu. In that menu, click on 'SEO'.
2
The 'SEO' settings will expand providing you additional options. Click on 'XML Sitemaps'.

If you do not see this option, please enable advanced features.

Yoast SEO > XML Sitemaps

3
Click on the appropriate sub-sitemap tab. Add or remove items as needed.
4
Click 'Save Changes'.

Author Sitemap

Our plugin creates a sitemap that lists the author pages. You can disable this sitemap, exclude users by their role or exclude an individual user.

Posts, Pages and Attachments

Posts and pages can be customized under the 'Post Types' tab or exclude individual items using the steps found here.
kb-customize-sitemap-1

Taxonomies

Categories, tags, and other taxonomies can be customized under the 'Taxonomies' tab. Some taxonomies are not added publically and thus do not appear for exclusion. When this occurs, the taxonomy can either be made public or you can manually exclude a non-public taxonomy using the filter wpseo_sitemap_exclude_taxonomy (example found below).

kb-customize-sitemap-2

This is an example of how to implement the filter in your functions.php file to exclude a taxonomy from the sitemaps. You'll want to replace 'taxonomy_slug' with the proper slug for the term you are looking to exclude. If you need to exclude two or more taxonomies, please use the second example. If you are not familiar with implementing code in WordPress, we highly recommend checking out Code Poet as they have a great list of available freelance WordPress developers.

/* Exclude One Taxonomy From Yoast SEO Sitemap */
function sitemap_exclude_taxonomy( $value, $taxonomy ) {
if ( $taxonomy == 'taxonomy_slug' ) return true;
}
add_filter( 'wpseo_sitemap_exclude_taxonomy', 'sitemap_exclude_taxonomy', 10, 2 );
/* Exclude Multiple Taxonomies From Yoast SEO Sitemap */
function sitemap_exclude_taxonomy( $value, $taxonomy ) {
if ( $taxonomy == 'taxonomy_slug1' || 'taxonomy_slug2' || 'taxonomy_slug3' ) return true;
}
add_filter( 'wpseo_sitemap_exclude_taxonomy', 'sitemap_exclude_taxonomy', 10, 2 );

Other Sitemaps

Video Sitemap

Our Video SEO plugin sitemap can be customized under Admin > SEO > Video SEO.

News Sitemap

Our News SEO plugin sitemap can be customized under Admin > SEO > News SEO.

Local Sitemap

Our Local SEO plugin sitemap is generated based on the location data entered into the plugin.

Non-Yoast Plugin Sitemaps

You can add non-Yoast sitemaps to the index. Please read this article for more information.

Was this article helpful? ·