Noindex orderby urls

#552469
  • Resolved Dre
    Rank Math free

    Hi,
    I noticed Rank Math is still indexing all sorting/orderby urls that Woocommerce creates when sorting products on archives. How can I set noindex, nofollow to them? They are creating duplicate content – why isn’t Rank Math doing this automatically or have the option anywhere to enable this?

Viewing 5 replies - 1 through 5 (of 5 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 the sorting / orderby to noindex:

    // Noindex filter queries
    add_filter( 'rank_math/frontend/robots', function( $robots ) {
    $url = home_url( $_SERVER['REQUEST_URI'] );
    if (strpos($url,'?orderby=') !== 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/#adding-filters-and-hooks-in-rank-math-php

    I hope that helps.

    Thank you.

    Dre
    Rank Math free

    Thanks. A few questions:

    1. Why isn’t this standard in Rank Math? Will you be adding this in the settings option?
    2. Would you recommend noindex, follow over noindex, nofollow? Google will eventually turn noindex, follow into noindex, nofollow…
    3. Rank Math is not adding canonical links on te orderby-url pages, is it?

    Hello,

    1. Typically, Google shouldn’t be able to crawl dynamic pages, at least from the sitemap and the page content hyperlinks. However, if Google can crawl them, then you can apply a noindex tag or disallow them in the robots.txt file.

    2. The nofollow attribute will tell the search engine not to follow that certain URL so if you wish for search engine not to follow the order by URLs, you can also do so using the filter code my colleague provided.

    3. By default the canonical URL for this type of page should be the https://example.com/shop/ and not the URL with the ?orderby=* query parameter, however, since you will apply a noindex tag for those pages, there is no need for a canonical URL.

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

    Dre
    Rank Math free

    Hi,
    thanks, ut my question 3 isn’t really answered: is Rank Math adding canonical links to the orderby urls? Because you should NOT have both, noindex AND canonical links, so if Rank Math adds these, it would be detrimental to ad noindex like your collegue described.

    Hello,

    Rank Math will add canonical as long as a URL is set to index.

    When you’re adding the filter shared above to set noindex to your orderby URLs, the canonical should be automatically removed from those URLs.

    Hope that clarifies your doubt.

    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 5 replies - 1 through 5 (of 5 total)

The ticket ‘Noindex orderby urls’ is closed to new replies.