Friday, December 11, 2009

WordPress With Better Meta Tags

Once again I am back with another WordPress fix. Google will report problems with a WordPress based web site unless you fix a few simple problems.

One thing that is needed is to put a description under each and every picture on your web site. Google looks for some text that is near to the picture to identify the picture. Then Google will use that text to place your picture into google image search results. That text can be done by using the caption tag that is available with every picture that you upload into your web site. Just make sure that you fill it in and do not just depend upon the name of the picture to get it listed.

Another problem is the lack of good meta tags in WordPress. There is a fix for this problem in the WordPress codex but it only places the post title into the meta tag. The results of doing this is that Google will then report that the meta tag is too short. The solution is to put your blog title, the categories, and then the post title into the meta tags. This is usually long enough to make Google happy. The code below does that with a "-" in between each of them.

< meta name="Description" content="< ?php if ( is_single() ) {
bloginfo('name'); echo " - "; foreach((get_the_category()) as $category) 
{ echo $category->cat_name . ' - '; } single_post_title('', true); 
} else { bloginfo('name'); echo " - "; bloginfo('description'); }
?> " />

< meta name="Keywords" content="< ?php if ( is_single() ) {
bloginfo('name'); echo " - "; foreach((get_the_category()) as $category) 
{ echo $category->cat_name . ' - '; } single_post_title('', true); 
} else { bloginfo('name'); echo " - "; bloginfo('description'); }
?> " />

No comments: