Make your wordpress title tag SEO friendly

December 29, 2008 · Print This Article

SEO is a very important part of your wordpress blog.

Because without a good SEO, you’re loosing lots of potential visitors.

In this recipe, we will know how to optimise the title of your wordpress blog for a better SEO.

Open your header.php file for edition. find the <title> tag, and replace it by the following code:

 


<title>
<?php if (is_home () ) {
bloginfo('name');
} elseif ( is_category() ) {
single_cat_title(); echo ' - ' ; bloginfo('name');
} elseif (is_single() ) {
single_post_title();
} elseif (is_page() ) {
bloginfo('name'); echo ': '; single_post_title();
} else {
wp_title('',true);
} ?>
</title>

This code will generate title tags according to the following model:

  • If the visitor is on the blog homepage: We’ll display the blog name.
  • If the visitor is on a category page: We’ll display the category name and the blog name.
  • If the visitor is on an article page: We’ll only display the article title.
  • If the visitor is on a static page: We’ll display the blog name, and the page title.

Your choice for site templates and wordpress themes

Comments

Got something to say?

You must be logged in to post a comment.