HOW TO: Meta Description & Keyword Tags On Author Pages


In this tutorial I’ll show you how to display meta description and meta keyword tags on the author pages of your Thesis website. Not just Thesis users, this guide is just as good for any WordPress installation (as no Thesis hooks are being used).

Let me give here the code I am using on Bong Buzz, a group blog maintained by me and my friends, to show meta description and meta keywords tags on author pages. More specifically, with this code you can:

  1. Show the first 160 characters of the author description (biographical info) as entered in the user profile as the meta description tag.
  2.  Show the author nicename (display name) and blog name as the meta keywords.

function authormeta() {
if (is_author ()) {
global $wp_query;
$curauth = $wp_query->get_queried_object();
$desc = substr($curauth->description,0,160);
echo '<meta name="description" content="'. $desc .'" />';
echo '<meta name="keywords" content="'. get_bloginfo('name') .', '. $curauth->user_nicename .'" />';
}
}
add_action('wp_head', 'authormeta');

Code explanation

Assigning the author into the variable $curauth and then using it in certain tags to retrieve and display desired user information. Using the substr PHP function to return only the first 160 characters. 160 because that’s the maximum size of meta description tag allowed by Google; 165 for Yahoo and 200+ for MSN.

Bottomline

Thesis not letting you specify meta description tags for author pages has been a major disappointment with users running multi-author blogs. For any standard group blog written by a handful of talented writers who care about their online identity, having meta description tags for author pages is a must. A recent study put the percentage of adults who google their names at 57% and if your blog is slightly popular, a writer in your blog team will get his/her author page on the first page of Google results when searching with his/her name. Which is all very good. Now the bad part – the snippet of the result looks totally ugly with random words picked up from the page by Google. To get meaningful and decent snippets on search engines, you need well written meta description tags for author pages on your website, be it running Thesis or not.

Warning: Direct copy-pasting of code from this page can give you invalid characters.


One response to “HOW TO: Meta Description & Keyword Tags On Author Pages”

Leave a Reply

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