rel=author – WordPress Author image in Google Search Result


Wanna show your Google profile picture with your site listing in Google Search ? Highlighting Author image in Google search result is possible now. Just a perfect markup will show your image on search result with a WordPress site post or article link and description. It is done by adding rel=”author” and rel=”me” HTML markup and a Google account.

Implementing rel=”author” requires three steps:
  • Place a link from post/article to a specific author page using rel=”author” in same domain
  • Another link from the author page to Google profile page using rel=”me”
  • A link from your Google profile page to the author page

Post Page

The first link is from your blog post to an author page on the same domain. This is essentially a link that tells Google about the authorship of the posts on that domain. That’s why you use rel=”author” on this link. A WordPress blog with multiple authors will have multiple author pages, with the posts each author has written pointing to their own author page using rel=”author”. For a single author site, you can simply use your about page because that is about the author of the site.

Most templates have the author of the post in a byline div located in Single Post file (single.php). Adding a rel=”author” attribute will do the first step.
Example:

echo sprintf( 'by <a href="%1$s" title="%2$s" rel="author">%2$s</a>', get_author_posts_url($post->post_author), get_the_author());

Author Page

The second link is from the author page to your Google profile page. This link tells Google that the author of that domain is the same person as the one in the Google profile. You’re essentially claiming that Google profile as your own, which is why you use rel=”me” on this link.

for this, edit the Author Template file (author.php) and add some code to show that authors google profile link.

$google = get_the_author_meta( 'google_url' ); if ( $google ) { echo '<a href="' . esc_url( $google ) . '" rel="me">Google Profile</a>'; } 

This will show the authors google_url meta. Now add a way, so that the author can add his url-

function user_google_url_field( $contactmethods ) { // Add Google Profiles $contactmethods['google_url'] = 'Your Google Profile URL'; return $contactmethods; } add_filter( 'user_contactmethods', 'user_google_url_field', 10); 

Add the upper code on the functions.php file and a fields will be visible on wp-admin/profile.php page add manage the google url.


Google Profile

At last, add a link from ur Google profile to your author page. Make sure you check the ‘This page is specifically about me.’ box when adding link to your wordpress site author page.


How To Check Your Work

To see if you’ve done everything correctly, run a sample blog post or article through the Google rich snippet testing tool.

That’s how I’ve implemented rel=author. Hope i will get the preview soon in real search engine.

Leave a Reply

Your email address will not be published.
* Required field.

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>