admin管理员组文章数量:1393392
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:
/
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.
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/mypost/
http://mypage/mypost/2
http://mypage/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 asked Aug 2, 2011 at 9:06 EddieEddie 211 gold badge1 silver badge2 bronze badges 1- 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 Commented Apr 12, 2012 at 18:31
5 Answers
Reset to default 4Is "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.
You may just add these lines to your header.php under title tag:
<?php if ( $paged < 2 ) { } else { echo (' Page '); echo ($paged);} ?>
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 );
?>
Above answer is not working due to global variable issue, we have to use '$paged' instead of '$page'. Following is updated solution
function wpse24661_filter_wp_title( $title, $separator ) {
// Globalize $page
global $paged;
// Determine if current post is paginated
// and if we're on a page other than Page 1
if ( $paged >= 2 ) {
// Append $separator Page #
$title .= ' ' . $separator . ' ' . 'Page ' . $paged;
}
// Return filtered $title
// echo $title;die;
return $title;
}
add_filter( 'wp_title', 'wpse24661_filter_wp_title', 101, 2 );
I have tried your method. But it's not get reflected in page title on blog pagination. Just hook the wp_title
as mentioned the same in functions.php
and ensure the same it's not working can you update any other ways to achieve it.
本文标签: paginationHow to change title tags on paginated posts
版权声明:本文标题:pagination - How to change title tags on paginated posts? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744608062a2615480.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论