Yoast SEO
Sitemap: exclude posts from category (5 posts)

  1. fuchsws
    Posted 3 years ago #

    right now I can select to exclude a category from the category-sitemap.xml - which works fine.

    however, all the posts from this category are still listed in the post-sitemap.xml

    is there an option to exclude posts from a certain category as well? I think this should be an option, as I do not want to individually exclude single posts but select categories which should completely be removed from all the sitemaps.

    thanks for a hint!


  2. Salpetriere
    Posted 3 years ago #

    I'd just like to chime in and let the good people behind Yoast know that we require this functionality also.

  3. jrf
    Posted 3 years ago #

    As you can set several categories per post, this would be kind of difficult to implement.

    Say you have chosen to exclude category A and all the posts from category A and you have chosen to include category B and all the posts from category B.
    Now you have a post tagged with both category A and B. What should the plugin do ?

    In other words, that's why it makes sense for this to be a setting on individual page/post level.

    Hope this helps.


  4. fuchsws
    Posted 3 years ago #

    Indeed, good thinking.

    but also editors don't really care about why posts should be excluded sometimes from the sitemap, so they won't set it manually. some developers use categories just for logical use (i.e. "show as highlight") but this category should not be included into the sitemap as it only affects the frontend display (yeah, i know - bad taxonomy ;-)

    maybe this needs to have some advanced options:

    [X] exclude posts from sitemap, if its category is excluded
    [X] exclude posts even if in other category which is not excluded

    This way the administrator can decide the behaviour of post exclusions.

  5. jrf
    Posted 3 years ago #

    There's a filter for that ;-)

    There's a string of filters available for altering the output of the sitemaps, some are described here. But if you look at the /wordpress-seo/inc/class-sitemaps.php file, you'll see there are plenty more available.

    Does that help ?


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Yoast SEO
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic