WordPress.org

Ready to get started?Download WordPress

Forums

WordPress SEO by Yoast
[resolved] Serious Canonical Issue with Paginated Posts (10 posts)

  1. maxbuxfiy
    Member
    Posted 11 months ago #

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

    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

    http://example.com/pagination-test/
    http://example.com/pagination-test/2/
    http://example.com/pagination-test/3/

    On page 1 (http://example.com/pagination-test/)
    Everything is OK, it outputs

    <link rel="canonical" href="http://example.com/pagination-test/" />
    <link rel="next" href="http://example.com/pagination-test/2/" />

    Going to page 2 (http://example.com/pagination-test/2/)
    All is well

    <link rel="canonical" href="http://example.com/pagination-test/2/" /> <-- This is good
    <link rel="prev" href="http://example.com/pagination-test/" />
    <link rel="next" href="http://example.com/pagination-test/3/" />

    Now to the last page 3 (http://example.com/pagination-test/3/)
    Things go totally wrong

    <link rel="canonical" href="http://example.com/pagination-test/" /> <--  This is so wrong
    <link rel="prev" href="http://example.com/pagination-test/2/" />

    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="http://example.com/pagination-test/3/" />
    <link rel="prev" href="http://example.com/pagination-test/2/" />

    http://googlewebmastercentral.blogspot.com/2013/04/5-common-mistakes-with-relcanonical.html

    Any ideas?

    http://wordpress.org/extend/plugins/wordpress-seo/

  2. maxbuxfiy
    Member
    Posted 11 months ago #

    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.

  3. maxbuxfiy
    Member
    Posted 11 months ago #

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

  4. maxbuxfiy
    Member
    Posted 11 months ago #

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

  5. lowlight
    Member
    Posted 9 months ago #

    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.

  6. oneruffryder
    Member
    Posted 9 months ago #

    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 : http://i43.tinypic.com/s26v87.jpg

    So , do you think this would fix it ?

  7. mbrsolution
    Member
    Posted 9 months ago #

    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

  8. jrf
    Member
    Posted 9 months ago #

    @maxbugfiy and all:

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

  9. mbrsolution
    Member
    Posted 9 months ago #

    Thank you @jrf ;)

  10. jrf
    Member
    Posted 9 months ago #

    You're welcome ;-)

Reply

You must log in to post.

About this Plugin

About this Topic