How To Generate SEO Titles for Pages

7 Flares 7 Flares ×

Its been a while since I wrote a post. Yesterday I was in the mood of uplifting my blog seo structure. There are alot of plugins which can do this for your website. Some are free and some are Premium. But for those who don’t like to use a lot of plugins, here is a nifty little piece of code which can do that for you.

In your themes header file , look for this bit of code

<!--?php wp_title('&laquo;', true, 'right'); ?--> <!--?php bloginfo('name'); ?-->

Delete this line and add this instead

 <!--?php if ( is_home() ) { ?--> | <!--?php bloginfo('description'); ?--><!--?php } ?-->  <!--?php if ( is_search() ) { ?-->Search Results for <!--?php /* Search Count */ $allsearch = &new WP_Query("s=$s&showposts=-1"); $key = wp_specialchars($s, 1); $count = $allsearch--->post_count; _e(''); echo $key; _e(' — '); echo $count . ' '; _e('articles'); wp_reset_query(); ?><!--?php } ?-->  <!--?php if ( is_404() ) { ?--> | 404 Nothing Found<!--?php } ?-->  <!--?php if ( is_author() ) { ?--> | Author Archives<!--?php } ?-->  <!--?php if ( is_single() ) { ?--><!--?php wp_title(''); ?--> | <!--?php  $category = get_the_category(); echo $category[0]--->cat_name;  ?> | <!--?php } ?-->  <!--?php if ( is_page() ) { ?--> | <!--?php  $category = get_the_category(); echo $category[0]--->cat_name;  ?>|<!--?php wp_title(''); ?--><!--?php } ?-->  <!--?php if ( is_category() ) { ?--><!--?php single_cat_title(); ?--> | <!--?php $category = get_the_category();  echo $category[0]--->category_description; ?> | <!--?php } ?-->  <!--?php if ( is_month() ) { ?--> | Archive | <!--?php the_time('F, Y'); ?--><!--?php } ?-->  <!--?php if ( is_day() ) { ?--> | Archive | <!--?php the_time('F j, Y'); ?--><!--?php } ?-->  <!--?php if (function_exists('is_tag')) { if ( is_tag() ) { ?--><!--?php single_tag_title("", true); } } ?--> |  

The code is real simple to understand and can be customized according to one’s need. You can change the “|” character with “-” or any other symbol of your choice. The Final Result after doing this to your Page and Post Titles will look like

  • Home Page – Blog Name | Blog Description
  • Search Results – Search Results for search terms – 11 Articles | Blog Name
  • 404 (Error) Page – Blog Name | 404 Nothing Found
  • Author Archives – Blog Name | Author Archives
  • Single Post – Post Name | Category Name | Blog Name
  • Page – Page Name | Blog Name
  • Category Page – Category Name | Category Description | Blog Name
  • Monthly Archive – Blog Name | Archive | Month, Year
  • Day Archive – Blog Name | Archive | Month Day, Year
  • Tag – Tag Name | Blog name

Source[link]

SEO or Search Engine Optimization is very important to rank higher in Search Results. It is essential to have your webpage or website nicely structured to get Organic Traffic!

Why i Don’t use plugins is because, plugins slow down your website. A user will have to wait more for the plugins to load so that he/she can view your webpage. Many WebDevelopers use 5 to 10 plugins for their webpages

=)
7 Flares Twitter 1 Tweet Facebook 0 Google+ 0 StumbleUpon 6 Pin It Share 0 7 Flares ×