pagination and canonical

#297567
Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello,

    Thank you for contacting Rank Math for help indexing your paginated pages.

    You can add the following code snippet to your theme’s functions.php. Th code snippet will set the paginated pages to have self-canonical tags:

    
    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;
    });
    

    To add the paginated pages to the sitemap you will have to create a custom filter. You can refer to our filters and hooks API for the appropriate method to add the paginated page to the sitemap: https://rankmath.com/kb/filters-hooks-api-developer/

    Hope that helps. Let us know if you have questions. We are here to help.

    I am trying to do the same thing. Why does Rank Math force this and have the need to edit the code to remove it.

    It is counterproductive and in my instance will prevent deeper blog and product pages the ability to be more readily indexed. Therefore negatively affecting my SEO from an SEO plugin.

    I don’t need them to be added to the sitemap, I’ll let them be crawled through a natural crawl.

    Is this something that can be fixed in the next update?

    Hello,

    Chris Peterson, thank you for raising your concern with us. The current thread required a solution which might be different from what you need. Please may you open a separate forum topic so we can come up with an appropriate solution.

    Looking forward to helping you.

    Hi Nigel,

    I actually think it’s the same issue. I have a blog section of a site, that on the paginated pages the canonical goes to the first page, not itself. Therefore, deeper blog pages are most likely not being crawled as the canonical designation is telling the search engine that the page is the same as first page. This is not the case as the the pagination represents the next blog posts. Ones I would like to be crawled and indexed.

    This is the same issue as above for Erez where you indicated that a piece of code was needed to have the paginated pages canonical to themselves, this is what I am looking for.

    Will this be a part of a future update? I’m really surprised it is set up this way at default with no option for the SEO managing the site to change it without code modification.

    Hello,


    @Chris
    Peterson, please open a new support ticket for your concerns as it’s easier for our team to debug the issues in isolation.

    Thank you.

Viewing 5 replies - 1 through 5 (of 5 total)

You must be logged in to reply to this ticket.