Archive

Archive for the ‘Oh Jeez Google What?…Rel=Me?’ Category

Oh Jeez Google What?…Rel=Me?

August 18th, 2011 No comments

rel=”author” and rel=”me” in WordPress
by Joost de Valk

The recent changes from Google and my post about it regarding the highlighting of authors in search caused quite a few questions. People have been asking me how to do specific things and how to make certain elements contain rel=”author” or rel=”me”. Instead of replying to each of those emails and comments I decided to write one post which “has it all”.

I did see some more examples pop up, for example, when I searched for [highlighting authors], both this post from Matt Cutts (on highlighting authors in the comments) and this post from Gina Trapani got an author highlight.

Is the link to the Google Profile from the author page required?
How to add rel=”author” to a link in your menu
How to allow authors to add rel=”me” to links in their bio’s
How to allow authors to set their Google Profile URL
How to change the author URL
More questions?

Is the link to the Google Profile from the author page required?

Apparently, yes, it is. It’s quite logical for Google to want a link from your Google profile to your author page, it makes 100% sure that you are indeed the author of that piece of content when you link to your Google Profile and back from your Google Profile to your author page. Of course the link to your Google Profile wouldn’t be 100% needed for this, I don’t know whether Google will keep this requirement.

The flow should thus be as follows: article links to author page on the same domain. The author page on the same domain links to the Google Profile. The Google profile, in turn, links back to the author page.

So you are not, as some people suggested, meant to link to your Google Profile straight from the article, instead, you should link to your author page on the domain you published the article at and that page in turn should link to your Google Profile and be linked from your Google Profile.
How to add rel=”author” to a link in your menu

One of the issues that came up with is that some people don’t want to show the author on each and every post when the author on that blog is always one single person. Those people will usually have an “about” page linked in their site’s main navigation, for instance, Robert Scoble, on his blog Scobleizer:

Scobleizer’s about link, that should have rel=”author”

That “about” link could very easily be used to identify him as the author of each and every post, to Google, if it had rel=”author” sticked to it. Turns out that this is actually very easy to do if you use the WordPress menu editor.

Go to the Menus page and in the top right, click on screen options:

WordPress Screen Options Link

Once you click that link, it’ll fold out, and the display options will show, including “Link Relationship (XFN)”, be sure to check that box:

Once that box is checked, you can edit your menu item to include the link relationshop “author” which will cause it to get rel=”author” added to it:

Custom Menu element, be sure to just add author, this will cause rel=author to be added to the linkBe sure to just add “author” (without the quotes) this is enough to make sure the link will have rel=”author” added to it.
How to allow authors to add rel=”me” to links in their bio’s

If you update your bio on a WordPress blog you write on to contain a link to your Google Profile and want to add rel=”me”, you’ll come to the conclusion that WordPress strips out all the rel elements from links. Why it does that is beyond me, I’ve already opened a Trac ticket and created a patch to allow it. Until that is in core though (if it makes it in), you’ll need to allow it yourself. To do that, simply add this to your site’s functions.php file or functionality plugin:

1 function yoast_allow_rel() {
2 global $allowedtags;
3 $allowedtags['a']['rel'] = array ();
4 }
5 add_action( ‘wp_loaded’, ‘yoast_allow_rel’ );

This will allow all rel values to be used, nofollow as well. You could tighten this more but I doubt you’ll need it.
How to allow authors to set their Google Profile URL

If you don’t want authors to add the link to their bio but would rather give them an input field to enter their Google Profile URL, you’ll need to hook into the contact methods functions of WordPress. First, tell WordPress you want to add the Google Profile contact method:
1 function yoast_add_google_profile( $contactmethods ) {
2 // Add Google Profiles
3 $contactmethods['google_profile'] = ‘Google Profile URL’;
4 return $contactmethods;
5 }
6 add_filter( ‘user_contactmethods’, ‘yoast_add_google_profile’, 10, 1);

This will add an input field on their edit profile page below the default AIM, Yahoo and Google Talk / Jabber contact methods:

Google Profile URL input field

Second, in your theme’s author.php file, the author template, you need to add a bit of code to output this new URL:
1 $google_profile = get_the_author_meta( ‘google_profile’ );
2 if ( $google_profile ) {
3 echo ‘Google Profile‘;
4 }

Of course you can style this in any way you want, show it in a list, etc. Here on yoast.com, for instance, I replaced the default contactmethods with Facebook, Twitter and the Google Profile.
How to change the author URL

If for one or more authors on your blog you want to change their default author URL, you could do something like this:
1 function yoast_change_author_link( $link, $author_id, $author ) {
2 if ( ‘admin’ == $author )
3 return ‘http://example.com/about-me/’;
4 return $link;
5 }
6 add_filter( ‘author_link’, ‘yoast_change_author_link’, 10, 3 );

This would change the author URL for the author with username “admin” to http://example.com/about-me/, you should of course change this to what you need in your specific case. This should work with most themes, if it doesn’t with your theme, let me know what theme you’re using and I’ll try to come up with a solution.
How can I test whether my rel=”author” implementation works

Once you’ve added one of this bits above, you probably want to test whether it’s working. To do that, use Google’s Rich Snippets testing tool. You can find an example report showing that my implementation is correct here. See the screenshot:

More questions?

Do you have any more questions? Ask them in the comments, I will update this post with the needed answers!

Update: just to show “off” that it works:

Umm…sure. Did anybody catch all of that? I posted this article in hopes it would help me. And it did to the point of rel=me if it is really me writing the content, but… is this necessary? If it’s not me I post the author. I think Google is asking a little to much here. But I guess I’ll give it a try.
This is the link going back to the original article
What do you think? Comment below

Categories: Oh Jeez Google What?...Rel=Me? Tags: