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 paginated pages to noindex:
add_filter( 'rank_math/frontend/robots', function( $robots ) {
$url = home_url( $_SERVER['REQUEST_URI'] );
if( (strpos($url,'?query-') !== false) ) {
$robots["index"] = 'noindex';
$robots["follow"] = 'nofollow';
}
return $robots;
});
And here’s a guide to adding the code to the website:
https://rankmath.com/kb/wordpress-hooks-actions-filters/
Let us know how this goes.
Hi,
Thanks for your reply, I will add it and let you know.
However – do you know why this started to happen (for to know and avoid with other sites using RankMath)?
Hello,
It seems that your paginated pages happen with an AJAX request (blog/?query-42-page=8&cst), and that doesn’t update the WP Query for the page, so our plugin cannot see that the page is being paginated.
Rank Math relies on the function is_paged() from WordPress, so the setting we use to noindex paginated pages is also not working.
You can also inspect the source code of those URLs, and the link rel="next" tag that is set is /blog/page/2/.
Looking forward to helping you.
Thank, I have implemented the filter and I can see that the paginated pages are noindex. Two last questions:
1. What should I do with the pages already indexed? request indexing for Google to see the changes?
2. I read in some places that its not recommended to noindex paginated pages? Do you have any article or info regarding best practices for paginated pages you can share?
Thank you very much for your help,
Dor
Hello,
1. Since you’ve already set the paginated pages to Noindex, allow Google some time to recrawl your pages and they will be automatically removed from SERPs.
You can also use the Removals tool in Google Search Console to remove this URL from SERPs: https://support.google.com/webmasters/answer/9689846?hl=en
2. It mostly depends on how you’re optimizing your paginated pages. If your paginated pages do not match the Google guidelines, it can create duplicate content or thin content issues which is harmful to your SEO. So, if you don’t have proper UI/UX for your paginated pages or proper canonical URLs, it is good practice to set them to Noindex.
To learn more about the best practices for your paginated pages, you can check this URL: https://www.searchenginejournal.com/technical-seo/pagination/
Hope that helps and please don’t hesitate to let us know if you have any other questions.
Â
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.