Support » Plugin: Yoast SEO » Serious Canonical Issue with Paginated Posts

  • Resolved maxbuxfiy


    WordPress version: 3.5.1.
    WordPress SEO version: 1.4.7, DEV,

    This could be a bug or maybe bad coding. The plugin seems to have canonical issues again on paginated posts.
    Example of a post paginated into 3 sections

    On page 1 (
    Everything is OK, it outputs

    <link rel="canonical" href="" />
    <link rel="next" href="" />

    Going to page 2 (
    All is well

    <link rel="canonical" href="" /> <-- This is good
    <link rel="prev" href="" />
    <link rel="next" href="" />

    Now to the last page 3 (
    Things go totally wrong

    <link rel="canonical" href="" /> <--  This is so wrong
    <link rel="prev" href="" />

    This means that Google might drop the 3rd page from the index since we are pointing to the 1st page as the canonical page.
    According to Google, It should read on page 3 (last page):

    <link rel="canonical" href="" />
    <link rel="prev" href="" />

    Any ideas?

Viewing 9 replies - 1 through 9 (of 9 total)
  • OK, I went through the code and found out Yoast made a logical error, maybe he needs more coffee or something 🙂

    On line 575 of class-frontend.php under the comment // Fix paginated pages canonical, but only if the page is truly paginated.

    $numpages = substr_count( $obj->post_content, '<!--nextpage-->' ) + 1;
    if ( $numpages && get_query_var( 'page' ) < $numpages ) {

    He forgot to cater for the last page in paginated which will be equal to $numpages

    Just add ‘=’ so it reads
    if ( $numpages && get_query_var( 'page' ) <= $numpages ) {

    All set.

    I don’t know if Yoast saw this so I will mark as resolved and maybe file a bug report.

    I don’t know if Yoast saw this so I will mark as resolved and maybe file a bug report.

    I just have to say, I have been following your posts fixing a lot of errors in this plugin that we count on.. My site relies heavily on paginated posts, and I have noticed a huge drop in google placement. Looking at my stats, I saw a lot of little issues that didn’t seem like a big deal at the time, but I think they all add up.

    Hopefully these fixes help improve things! Thanks a bunch!

    I actually had a custom plugin created to show post titles of the “Next Page” link.. IE “Next page: This Content”… I see there’s a free one now

    What I really wish for is the ability to set custom <title> tags for each page in a post.. So instead of just “Title of article – Page 2” we have “Title of article – This content”. This should help readers as well as google. Ideally the same could be done for meta tags.

    If you know of anything like this, please let me know! I’d be willing to chip in for a plugin that does this.

    i m having similar issues with Yoast plugin, did this solved your problems ?

    I asked for fix , but there is no reply…Basically

    I found inside my webmaster tool,a huge number of duplicate title tags (1700) and meta description (1050)..

    Basically, errors are showing /0/ at the end or sometimes the same title twice written

    Screenshot :

    So , do you think this would fix it ?

    Hi @maxbuxfiy, thank you very much for your solution. I had a look at the file and implemented your solution and now I have to wait and see if it does help me or not!!! However I can see the logic behind the = symbol. I guess it is something that can happen to anyone especially an = symbol. 🙂

    @lowlight I have had that problem for the last 7 months :). I think I have read more than 20 forums and no one really has an answer to this duplicate problem. I was thinking of not using <!--nextpage--> because of the duplicate issue. But known me I keep searching for an answer. Perhaps you can share with me what is the other plugin you have come across?

    Kind regards

    @maxbugfiy and all:

    FYI: I’m committing your fix to the plugin. It should be in the next included in the next release.

    Thank you @jrf 😉

    You’re welcome 😉

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Serious Canonical Issue with Paginated Posts’ is closed to new replies.