Forums Forums Search & Filter Pro Canonical tags on paginated pages – WPSEO

Viewing 4 posts - 1 through 4 (of 4 total)
  • Anonymous
    #30912

    I almost found a solution:

    I used a custom function to generate new canonical tags on paginated pages:

    function wpseo_custom_rel_next_prev_canonical_links(){
        global $paged;
        
        if ( get_previous_posts_link() ) {
            echo "<link rel='prev' href='".get_pagenum_link( $paged - 1 )."' />";
        }
    
        if ( get_next_posts_link() ) {
            echo "<link rel='next' href='".get_pagenum_link( $paged +1 )."' />";
        }
    
    }
    add_action( 'wp_head', 'wpseo_custom_rel_next_prev_canonical_links' );

    It works on my search page which use search.php. But it return nothing on my home page which use a shortcode to insert “Search & Filter” results. I think get_previous_posts_link() and get_next_posts_link() return false or $paged doesn’t exist on this page…

    Anonymous
    #106093

    Hi,

    Did you ever figured this out? I am also getting error 400 because the paginated pages of the shop are like this :

    http://www.teambuildingmadeeasy.com.au/shop/?sf_paged=4

    I have over 2000 of error 400 links because of this and my website dropped in rank.

    Is there any solution to this.

    Please help.

    Anonymous
    #135846

    Any info in here? That would be helpful!

    Trevor
    #135862

    As it is WP SEO adding these, you would need to use their filters to change what is output.

    See these pages as an example:

    https://gist.github.com/amboutwe/2aa7dcc9a38986e11fac68c7306cc091

    https://kb.yoast.com/kb/is-the-plugin-compatible-with-paginated-content/

    If you explained what you need on their help forums, I am sure you would get some better examples.

Viewing 4 posts - 1 through 4 (of 4 total)