Getting Google to use author pictures for Drupal sites
Note: Google has retired Page Authorship so this article is now out of date. Author rank is Google's current effort and is described well here.
To get a profile picture and authorship metadata on your articles in Google you need to jump through a few hoops. To do this there are three basic steps. Here is a recipe for doing just that in Drupal 7.
1. First you need a validated email address.
With your email address in the same domain as your website. We use Google Apps for Business and have multiple domains. I can add an email for each of them using this form. This will add Contributor links in the Links section of your G+ Profile. On the same page you can check that your Email addresses under Contact information have been verified (they will have ticks next to them).
https://plus.google.com/authorship
While you're on your G+ profile why not add Drupal as a site you contribute to?
http://support.google.com/webmasters/bin/answer.py?hl=en&answer=1408986&...
2. You need to add author links to your Drupal website's posts.
First you need to make sure that usernames are displayed on the appropriate content types.
Then you need to modify the username link. You can do this in a preprocess function in your theme or install the dev version of the Metatag module. What you want to see is a rel tag on the link containing your author name. You also probably need your username to match your Google Plus name. For example I needed to change my Drupal username from mr.snow to mr snow as that is what Google has.
By <a href="drupal website profile URL" rel="author">mr snow</a>
I found that I couldn't get the Metatag module to spit out the right markup so I made a username theme function instead. Here it is from our themes/custom/would/template.php file.
function would_preprocess_node(&$variables, $hook) {
$variables['submitted'] = 'By ' . theme('username', array(
'account' => $variables['node'],
'authorship' => TRUE
)) . ' on ' . $variables['pubdate'];
}
function would_preprocess_username(&$variables) {
if (!empty($variables['authorship'])) {
$variables['link_attributes']['rel'] = 'author';
}
}
3. On your profile page you need a link back to your Google ProfileI created a link field called Google profile here. And a couple of other social sites while I was at it.http://example.com/admin/config/people/accounts/fields And in it I put the link to my profile making sure to add the correct ?rel=author query at the end.https://plus.google.com/104271230665660923074?rel=author Which creates http://hollysydney.com/users/mr-snow That's itOnce you've wired up these three things you can test it all here.
http://www.google.com/webmasters/tools/richsnippets?url=http%3A%2F%2Fhol...