Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've created many post with multiple pages with the nextpage-tag. The problem is that these show up as errors in "Google Webmaster Tools" because of duplicate title tags and meta descriptions.

The urls are like this:

http://mypage.com/mypost/
http://mypage.com/mypost/2
http://mypage.com/mypost/3

all of which have the same title and meta tags.

Is it somehow possible to include the page number to the meta tags?

I'm using the "WP SEO" which surprisingly doesn't have this feature.

share|improve this question
    
Hi do you have any answer for this problem, I have the same problem with pagination on my website : enter link description here and I can't fix it since 1 mounth ! Best Regards –  user15127 Apr 12 '12 at 18:31

3 Answers 3

You may just add these lines to your header.php under title tag:

<?php if ( $paged < 2 ) { } else { echo (' Page '); echo ($paged);} ?>
share|improve this answer

Is "WP SEO" = "WordPress SEO by Yoast"? If so, the plugin has some tags for you:

  • %%page%% - Replaced with the current page number (i.e. page 2 of 4)
  • %%pagetotal%% - Replaced with the current page total
  • %%pagenumber%% - Replaced with the current page number

Just look at the bottom of the page wp-admin/admin.php?page=wpseo_titles, you'll see. Just try it.

share|improve this answer
    
Yes, but I can't define paginated posts created by the nextpage tag in this plugin. At least I don't know where. –  Eddie Aug 2 '11 at 9:45
    
I just tried to add %%page%% to the Post title template with no effect. –  Eddie Aug 2 '11 at 10:17
    
@Eddie please use comments for discussion of answers. If you have new details on your question you can edit it to add them. –  Rarst Aug 3 '11 at 13:13
    
Oh, I misunderstood your question. You meant one post with pages while I was thinking about pagination of many posts like in a loop. Ignore the answer. –  Rilwis Aug 3 '11 at 15:07

Try using the $page global to filter wp_title:

<?php
function wpse24661_filter_wp_title( $title, $separator ) {
    // Globalize $page
    global $page;

    // Determine if current post is paginated
    // and if we're on a page other than Page 1
    if ( $page >= 2 ) {
        // Append $separator Page #
        $title .= ' ' . $separator . ' ' . 'Page ' . $page;
    }    
    // Return filtered $title
    return $title;
}
add_filter( 'wp_title', 'wpse24661_filter_wp_title', 10, 2 );
?>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.