Support » Plugin: Yoast SEO » [Plugin: WordPress SEO by Yoast] WARNING: Duplicate Meta Descriptions and Title Tags when Paginating

Viewing 15 replies - 1 through 15 (of 24 total)
  • 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

    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.

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

    Yoast should address this and fast!

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

    Same problem here.

    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.

    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

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

    The code goes in your functions.php file

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

    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

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

    which theme are you using?

    I use atahualpa

    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]

    Plugin Author Joost de Valk


    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.

    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.

Viewing 15 replies - 1 through 15 (of 24 total)
  • The topic ‘[Plugin: WordPress SEO by Yoast] WARNING: Duplicate Meta Descriptions and Title Tags when Paginating’ is closed to new replies.