Adding Noindex Pages to Sitemap

#310596
  • Resolved Georgi
    Rank Math free

    Dear RankMath Support 🙂

    I wish to know how can noindex pages be added to the sitemap? The idea is that after purging my site cache I run a crawler feature from my caching plugin (LiteSpeed) which crawls the sitemap and caches the pages. But more than 50% of the products on my site are noindex.

    I wish to add them to the sitemap so that when the cache is purged they can be crawled and cached too together with the indexable pages.

Viewing 1 replies (of 1 total)
  • Anas
    Rank Math business

    Hello,

    Thank you for contacting Rank Math.

    Please add this filter in the theme’s functions.php file to add noindex URLs in the Sitemap:

    /**
    * Filter to add <code>noindex</code> URLs in the Sitemap
    *
    * @param bool $value Whether to include noindex terms in Sitemap.
    * @param string $type Object Type.
    *
    * @return boolean
    */
    add_filter( 'rank_math/sitemap/include_noindex', function( $value, $type ) {
    	return true;
    }, 10, 2 );

    I hope this helps.

    Looking forward to helping you.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 1 replies (of 1 total)

The ticket ‘Adding Noindex Pages to Sitemap’ is closed to new replies.