Avoid duplicating the titles using the tag

As it’s known there is a tag <!--nextpage--> in Wirdpress, which allows to break long article into two or more parts.

It’s also known that Google doesn’t like when artcles’ titles are duplicated completele (it will be markes at webmaster bar).

While deviding the page woth tag <!--nextpage--> the totles are duplicated to equal.

Today I’ve spent much time to decide how to solve it. Searching through official documents and WordPress forum brought nothing, even like applying different SEO- plugins. At last, to my pleasure, such a decision was found in the article of one indonesian web-designer «Avoiding Duplicate Title Tag on WordPress Post».

Here is the point.

You should find the line in the file header.php, which contains

1 <title> ... </title>

Before </title> add

1 <?php
2 if ( get_query_var('page') ) {
3 print ' – Part ' . get_query_var('page');
4 }
5 ?>

Then open single.php, and change

1 <?php the_title(); ?>

to

1 <?php
2 the_title();
3 if ( get_query_var('page') ) {
4 print ' - Part ' . get_query_var('page');
5 }
6 ?>

It will allow to make nice title for the secondpage, not only meta-tag title.

If there is no definite task for searching optimization, I use SEO- plugins seldom last time, Google officially doesn’t count meta-tag keyword anв the title can be made nice in WordPress template.

Here is the example of the code (together with page numbers for the articles devided by tag <!--nextpage-->)

01 <title>
02 <?php if ( is_home() ) { ?><?php bloginfo('description'); ?> - <?php bloginfo('name'); ?><?php } ?>
03 <?php if ( is_search() ) { ?><?php echo $s; ?> - <?php bloginfo('name'); ?><?php } ?>
04 <?php if ( is_single() ) { ?><?php wp_title(''); ?> - <?php bloginfo('name'); ?><?php } ?>
05 <?php if ( is_page() ) { ?><?php wp_title(''); ?> - <?php bloginfo('name'); ?><?php } ?>
06 <?php if ( is_category() ) { ?>Category: <?php single_cat_title(); ?>. <?php bloginfo('name'); ?><?php } ?>
07 <?php if ( is_month() ) { ?>Archives <?php the_time('F Y'); ?>. <?php bloginfo('name'); ?><?php } ?>
08 <?php if ( is_tag() ) { ?> <?php bloginfo('name'); ?>: <?php single_tag_title();?><?php } ?>
09 <?php if ( is_404() ) { ?>Sorry, your request nothing has been found! - <?php bloginfo('name'); ?><?php } ?>
10 <?php if ( get_query_var('page') ) { print ' - Part ' . get_query_var('page'); } ?>
11 </title>

 

RSS

2 Responses to "Avoid duplicating the titles using the tag "

  1. Great article, thank you again for wriintg.

  2. I am trying your tips in my blog…Thanx a lot for the share! :-)

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>