• Resolved Aleksandar

    (@aleksandarsavev)


    Hi, all, I’m trying to exclude a lot of pages dynamicaly with noindex in rank_math_robots meta key.

    I set up the filter rank_math/sitemap/include_noindex to return false.

    And that didn’t work. So I dig a little further and I found that the problem with this approach is that the internal Rank Math function, which is fetching the rank_math_robots metadata, is passing single = true parameter to the get_meta function:
    class-metadata.php:75 > returnget_metadata( $this->meta_type, $this->object_id, $property, true );
    This is preventing the helper method to return an array => the rank_math/sitemap/include_noindex cannot exclude the pages.

    Could you check if this is expected behavior? It would be useful to exclude the noindex pages from the site map with the rank_math/sitemap/include_noindex filter.

    Thank you in advance.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Rank Math Support

    (@rankmathsupport)

    Hello @aleksandarsavev,

    Thank you for contacting Rank Math support.

    The pages set to Noindex are excluded from the sitemap by default. You don’t need to use a filter for that. Please remove the filter and follow these steps:
    1. Flush the Sitemap cache by following this video screencast:
    https://i.rankmath.com/pipRDp

    2. Exclude the Sitemap files of the Rank Math plugin in your caching plugin. The cache could be via a plugin or from the server. For plugins or Cloudflare, please follow this article:
    https://rankmath.com/kb/exclude-sitemaps-from-caching/

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

    Thread Starter Aleksandar

    (@aleksandarsavev)

    Thank you for the quick response. Actually they are included. I checked the metadata for a single page – it’s rank_math_robots = ["noindex"]. However, the page is considered indexable because of the bug I mentioned above. I debugged it, this is why I’m so convinced.

    The metadata is fetch using single=true, which will return noindex instead of an array ['noindex'], which is the condition for non-indexable page.

    Plugin Support Rank Math Support

    (@rankmathsupport)

    Hello @aleksandarsavev,

    We are sure that the sitemap automatically excludes the pages set to “noindex”.

    The file you mentioned before has no influence on the sitemap generation, so any code added inside it is irrelevant.

    The most likely reason for this is the caching on the sitemap or the fact that you are setting the pages to “noindex” programmatically with a filter that runs after the functions from our sitemap.

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Unable to exlcude pages from sitemap – bug probably’ is closed to new replies.