I don’t want RankMath to add tags automatically

#538271
  • Resolved Dipti Parmar
    Rank Math free

    Rankmath is inserting canonicals by itself that we’re not able to remove. Also, it is adding meta robots = “follow index” where we’ve manually added “nofollow noindex” (the filtered pages that we don’t want Google to index because we’ve canonicalized them to the /product page). However, we’re seeing in Search Console that Google is still trying to index them (because Rank math automatically adds that line — and we can’t remove it) unsuccessfully (because we’ve stopped it via robots.txt). This is wasting our crawl budget.

    Now we have a problem with line 28 and 29. We don’t want google to crawl this page so we have disallowed this(and many such other) via robots.txt, but if I am not doing it via RankMath it by default adds robots tag (index, follow) I don’t want RankMath to add any robots code here.

Viewing 1 replies (of 1 total)
  • Hello,

    Thank you for contacting Rank Math and bringing your concern to our attention. I’m sorry for any inconvenience this issue may have caused you.

    In this case, you can use this filter to set those filtered pages to noindex and remove the canonical URL:

    // Noindex filter queries
    add_filter( 'rank_math/frontend/robots', function( $robots ) {
    $url = home_url( $_SERVER['REQUEST_URI'] );
    if (strpos($url,'?yith_wcan=') !== false) {
    $robots['index'] = "noindex";
    $robots['follow'] = 'follow';
    };
    return $robots;
    });

    And here’s a link to how to apply this to your site:
    https://rankmath.com/kb/filters-hooks-api-developer/

    Once done, clear your website’s cache and check again.

    Hope that helps.

    Thank 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 ‘I don’t want RankMath to add tags automatically’ is closed to new replies.