WordPress.org

Ready to get started?Download WordPress

Forums

WordPress SEO by Yoast
[resolved] WARNING: Duplicate Meta Descriptions and Title Tags when Paginating (24 posts)

  1. maxbuxfiy
    Member
    Posted 2 years ago #

    WARNING: Duplicate Meta Descriptions and Title Tags when Paginating
    Although the WordPress SEO plugin was mentioned by Matt Cutts (Google spam team) has having implemented rel= “next” and rel =“previous” elements, it does not adhere to unique titles & descriptions when you paginate.

    This means that if you break a long post into 3 pages (<!—nextpage-->) i.e
    example/3/
    example/2/
    example/

    Yoast’s plugin will display the same title and description across all pages and Google will penalize you for duplicate content.

    If you have paginated posts, check your Google webmaster account HMTL suggestions.

    The issue of duplicate content when paginating has been discussed in detail by a Google employee here.

    http://www.google.com/support/forum/p/Webmasters/thread?tid=344378292ff91e8d&hl=en

    Ultimate SEO has already addressed this by adding page number after title and the description when you paginate.

    Yoast should address this and fast!

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

  2. oriolo
    Member
    Posted 2 years ago #

    I've the same problem! Anybody knows how to solve it?

  3. Jabawack
    Member
    Posted 2 years ago #

    Same problem here.

  4. maxbuxfiy
    Member
    Posted 2 years ago #

    Seems Yoast won’t fix this anytime soon so we have to do it ourselves.

    I am not a programmer so if there are easier ways to do this, suggestions are welcome.

    Fixing the titles:

    In your templates’ header.php where Yoast suggests you place,
    <title><?php wp_title(''); ?></title>

    Replace it with

    <title><?php wp_title(''); if ( $paged >= 2 || $page >= 2 ) echo ' | ' . sprintf( __( 'Page %s'), max( $paged, $page ) ); ?></title>

    This will place | Page 2 and so on if your post is paginated and will leave the title unchanged on the first page.

    Fixing Meta descriptiosn

    In WordPress SEO folder (plugin directory) you need to edit class-frontend.php (inside frontend folder).

    Find function metadesc around line 537.

    On line 541 where it reads
    global$post, $wp_query; add $page so it reads
    global $post, $wp_query, $page;

    Scroll down to line 586, it should read
    $metadesc = apply_filters( 'wpseo_metadesc', trim( $metadesc ) );

    Bellow this line add

    if ($page >= 2){
    $page_number = ' | Page '.$page;
    }

    Then on line 594 where it reads:
    echo '<meta name="description" content="'.esc_attr( strip_tags( stripslashes( $metadesc ) ) )'"/>'."\n";

    add the $page_number variable. It then should read:

    echo '<meta name="description" content="'.esc_attr( strip_tags( stripslashes( $metadesc ) ) ).$page_number.'"/>'."\n";

    This works just like the title, it will check if the page is greater or equal to 2 and if the result is true, it will append the page number to the $page_number variable.

    The | Page is echoed as it is to prevent striping the whitespaces. You can change | to – or : or any other character you wish. It’s just a separator, however you should leave the space before and after | Page

    Hope this helps. Its working for me. Remember, if you upgrade the plugin or change your theme, you have to redo this.

  5. maxbuxfiy
    Member
    Posted 2 years ago #

    New solution. You can use filters and avoid redoing the whole processing when upgrading. Take a look at the second answer.

    Add Page number to Meta Description in WordPress SEO by Yoast

  6. kletskater
    Member
    Posted 2 years ago #

    q: where do you place the code as suggested in your above link?

  7. maxbuxfiy
    Member
    Posted 2 years ago #

    The code goes in your functions.php file

  8. kletskater
    Member
    Posted 2 years ago #

    thanks for responding
    when enter the code at the end of the original code, my functions.php breaks
    don't know what went wrong

  9. maxbuxfiy
    Member
    Posted 2 years ago #

    if ( ! function_exists( 't5_add_page_number' ) )
    {
        function t5_add_page_number( $s )
        {
            global $page;
            $paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
            ! empty ( $page ) && 1 < $page && $paged = $page;
    
            $paged > 1 && $s .= ' | ' . sprintf( __( 'Page: %s' ), $paged );
    
            return $s;
        }
    
        add_filter( 'wp_title', 't5_add_page_number', 100, 1 );
        add_filter( 'wpseo_metadesc', 't5_add_page_number', 100, 1 );
    }

    Paste this as it is in your functions.php. Do not place php opening and closing tags on this. BUT DO NOT place it inside another function

  10. kletskater
    Member
    Posted 2 years ago #

    @ maxbuxfiy
    i entert the above code but nothing changed.
    Do you have an example page ?

  11. maxbuxfiy
    Member
    Posted 2 years ago #

    which theme are you using?

  12. kletskater
    Member
    Posted 2 years ago #

    I use atahualpa

  13. maxbuxfiy
    Member
    Posted 2 years ago #

    I just tested Atahualpa 3.7.7 on my development server an its works fine.

    Remember the page numbers will show only on paginated posts, if you are looking at page 1 they will not show. Here is where I posted in Atahualpa functions.php

    [Code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin]

  14. Joost de Valk
    Member
    Plugin Author

    Posted 2 years ago #

    Ehm, there is actually a %%page%% variable you can use in your title templates on the SEO -> Titles page that does this without the need for all that code.

    Also, if you, under SEO -> Indexation, check the first checkbox, to noindex subpages, you won't have this problem at all.

  15. kletskater
    Member
    Posted 2 years ago #

    Hello Joost, thanks for your comment.
    I also like to keep it simple with no mess in the code.
    However, today I'm blonde and I can not find where ff%%%% page to fill out.
    I'm Also wondering what check the checkbox noindex subpages for impact on the google search results.
    --
    Hallo Joost, bedankt voor je reactie.
    Ik hou het ook graag simpel zonder rommelen in de code.
    ik ben echter blond vandaag en kan ff niet vinden waar ik %%page%% moet invullen.
    Vraag me tevens af wat het aanvinken van noindex subpages voor gevolgen heeft voor de google zoekresultaten.

  16. Joost de Valk
    Member
    Plugin Author

    Posted 2 years ago #

    SEO -> Titles page.

  17. maxbuxfiy
    Member
    Posted 2 years ago #

    @Yoast if I set the title when publishing (SEO Title), wouldn’t that override the default template settings?
    I have tried using
    <title><?php wp_title(''); ?></title>
    in my header and
    %%title%% | %%page%%
    in the title template and I only get %%title%% |
    The page number is not generated. Also, if i set the SEO title, only the title is returned.

  18. Joost de Valk
    Member
    Plugin Author

    Posted 2 years ago #

    Yeah but you're using a paged article then?

  19. maxbuxfiy
    Member
    Posted 2 years ago #

    Yes, as I stated in the initial post, the issue arises when I paginate posts. Everyone is worried for their site these days (Panda, Penguin and all :-)

  20. Joost de Valk
    Member
    Plugin Author

    Posted 2 years ago #

    Fair point. Just fixed %%page%% to work on those single pages / posts in trunk, this will be in the 1.1.7 release later on.

  21. maxbuxfiy
    Member
    Posted 2 years ago #

    Thanks Yoast

  22. Joost de Valk
    Member
    Plugin Author

    Posted 2 years ago #

    My pleasure :)

  23. karbanovich
    Member
    Posted 2 years ago #

    Have a problem here.
    i have a wordpress 3.3.1 and yoast SEO 1.1.9
    and in SEO -> Titles i have description set up and title but when it goes to second page i have no title nor description. and on the first page the %%page%% is not converted in description to the page number but still keeps as %%page%%.
    you can see what i mean here
    http://www.visualitee.com/shop
    http://www.visualitee.com/shop/page/2

    is there a way to fix it or go around it? thanks!

  24. Narendra
    Member
    Posted 1 year ago #

    I am facing problem for comment paging. webmaster gives error for duplicate meta titles & desc.

    i tried adding %%page%% & %%pagenumber%% in article type. but not adding comment page number
    My URL is like http://www.sitename.com\pagetitle\comment-page-4

    i tried
    if ( ! function_exists( 't5_add_page_number' ) )
    {
    function t5_add_page_number( $s )
    {
    global $page,$cpage;
    if($cpage > 0)
    $s = $s.'comment-page:'.$cpage;
    return $s;
    $s = "";
    }

    add_filter( 'wp_title', 't5_add_page_number', 100, 1 );
    add_filter( 'wpseo_metadesc', 't5_add_page_number', 100, 1 );
    }

    this is working for desc but not for title.

    Any idea or suggestions ?
    thx in adv.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic