Currently Available: Need a skilled Software Developer for your next project?
Categories
WordPress

Managing Yoast Sitemaps for Posts, Pages, and Custom Types

On a WordPress site, Yoast SEO’s sitemap settings control which posts, pages, and custom post types appear in the XML sitemap. Search engines use this file to discover site URLs. Yoast’s sitemap index is the main file; it links to separate sitemap files for different kinds of content.

The main control is each content type’s Show in search results? setting under Yoast SEO → Settings → Content types. When you turn the setting on, Yoast includes the type in search results and adds its eligible URLs to the sitemap. When you turn it off, Yoast sets the type to noindex, which tells search engines not to index it, and removes it from the sitemap. Before you change visibility, check the setting and the generated XML. This is especially important if you want to remove a custom type from the sitemap while keeping it available to search engines.

How the visibility setting maps to each content type

Yoast applies the same visibility control to standard posts, pages, and custom post types. A custom post type is a WordPress content category created for material beyond ordinary posts and pages, such as products or events. In Content types, find the relevant type and check its Show [type] in search results? toggle. Yoast’s sitemap settings documentation explains that showing a type in search results includes it in the sitemap, while removing it from search results removes it from the sitemap.

For example, when you turn off the setting for Pages, Yoast removes pages from search results and the sitemap. The same happens when you turn it off for Posts or a custom post type. Use the toggle only if you want to exclude the whole type from both search results and the sitemap, because it also sets the type to noindex.

A type’s setting controls the type as a whole. To remove an individual post or page from the sitemap, Yoast’s guidance is to mark that URL noindex. That setting tells search engines not to index the page and removes the URL from the sitemap.

Some custom post types do not appear in the settings. Yoast says this can happen when WordPress has not registered the type as public, a setting that makes the type publicly available. You can make the post type public or use the developer filter wpseo_sitemap_exclude_post_type to exclude it. If you use that filter, test the generated sitemap: a WordPress support discussion reports that excluding a post type can also remove a custom sitemap that depends on it.

What appears in the sitemap index

Yoast’s sitemap index links to separate sitemap files for content and other site data. Depending on the site’s settings and available content, those files can cover posts, pages, and authors. They can also cover categories, tags, and other taxonomies. A taxonomy is a way WordPress groups content, such as categories or tags. The Yoast explanation of the sitemap index describes the available controls under Content types, Categories & tags, and Advanced settings.

When Yoast has eligible URLs for an included content type, it adds a link to that type’s sitemap in the index. The index commonly uses the address sitemap_index.xml. Each post or page sitemap is a separate file linked from the index. Submit the index address to search engines rather than submitting each child sitemap separately, as Yoast explains in its submission instructions.

Yoast also offers developer filters for sitemap contents. For example, wpseo_sitemap_exclude_post_type excludes post types, while wpseo_sitemap_exclude_taxonomy and wpseo_sitemap_exclude_author exclude taxonomy and author sitemaps. These controls affect sitemap output; they do not replace checking the relevant search-visibility setting when you intend to control whether a content type can appear in search results.

Verify the index and its URLs

Open your site’s sitemap index, typically at https://example.com/sitemap_index.xml, replacing the example domain with your own. You can also use Yoast’s sitemap link in the plugin settings; the location varies by Yoast version. The index should load as XML and show links to the available sitemap files.

Open the separate sitemap file for each type you expect to include. Check that it contains the expected URLs and that each URL points to the intended public address. If a type should be excluded, confirm that its sitemap link no longer appears in the index and that its URLs do not appear in another sitemap. Check the page itself as well if you turned off search visibility, because that choice sets the type to noindex.

After a settings change, check the live XML if the index or a separate sitemap file looks out of date. Do not rely on a saved copy or a cached browser result. If a sitemap URL returns an error, investigate the site’s caching and permalink configuration before concluding that the visibility toggle failed.

What I'm building

Delegate tasks. Get software.

Give Vroni a GitHub issue, bug report, spec, or rough idea. It reads the repo, plans the change, writes code, runs checks, and works toward a review-ready pull request.

Take a look at vroni.com

Email updates

Usually a new article and a few links I found interesting.

No spam. Unsubscribe with one click.

Leave a Reply

Your email address will not be published. Required fields are marked *