-
Hello, I need some help regarding pagination. I tried to look for it on the forum but couldn’t find anything that would help me fix the issue.
This is my first category page:
https://xyz.com/category/business-finance-books/
It has the index,follow tags, and canonical tag pointing to itself. That’s completely fine.This is the second category page:
https://xyz.com/category/business-finance-books/page/2/
Currently, it has noindex, follow tags but the canonical tag is missing.I tried pasting the code in the functions.php file
add_filter( 'rank_math/frontend/canonical', function( $canonical ) {
if ( is_paged() ) {
$link = $_SERVER['REQUEST_URI'];
$arr = explode('/p/', $link,);
$canonical = home_url($arr[0]. '/');
}
return $canonical;
});But it doesn’t work unless I put pagination on the index, follow.
I want my pagination to look like this
https://xyz.com/category/business-finance-books/page/2/
noindex, follow, and canonical tag pointing to https://xyz.com/category/business-finance-books/Is it possible to have both noindex, follow tags on the second page and canonical tag pointing to the main page?
Thanks in advance.
The ticket ‘Pagination noindex, follow + canonical’ is closed to new replies.