Getting the new Google author meta working

August 07 Comments Off on Getting the new Google author meta working Category: Actual, Code, Web Design, Wordpress

So I decided this morning that I wanted to get the new author meta information working on my main blog. The goal being that when an article from HackText shows up in a Google Search it will show a nice thumbnail of me with a link to my Google Profile on the Google search page. Should be simple right?

So I encountered a number of problems in attempting to do this. Here’s the laundry list:

  • WordPress does not have a simple way to link to an author archive.
  • Google requires that your Profile have a link to any page you wish to designate as an author page.
  • For it to work, some pages need to have rel=”me” and others need to have rel=”author”.
  • My theme used a WordPress call that simultaneously pulled both the link and the author name into the site with an automatic (and editable) link to the author page.
  • I don’t use a custom menu (though I probably should).

Here was my solution:

(Google help page for authorship.)

I went to archive.php and found the author archive loop. I modified the title for the author archive loop as follows:

It was just

<?php /* If this is an author archive */ } elseif (is_author()) { ?>

Author Archive

<?php }

and I changed it to

<?php /* If this is an author archive */ } elseif (is_author()) { ?>

Author Archive <br /><a rel="me" href="https://plus.google.com/108109243710611392513/posts">Aram Zucker-Scharff</a>

<?php }

Note the above rel=”me” tab as this is very important.

I then had to add the author archive page’s URL to my Google Profile while checking the option that “This is a page specifically about me.”

Then in single.php (the loop for a single story) I had to change where it displayed my name from

<span>By <?php the_author_posts_link(); ?></span>

to

<span>By <a href="<?php get_site_url(); ?>/author/<?php the_author_meta('user_login'); ?>/" rel="author" alt="<?php the_author(); ?>" title="<?php the_author(); ?>"><?php the_author(); ?></a></span>

To make sure it all worked correctly, I tested both the author archive page and a post in the Rich Snippets Testing tool.

Now it works the way it should.

Next step, figure out how to do it programmatically (so it will work for anyone) and in a multi-author blog.

Does anyone else find this whole thing needlessly complicated? Why can’t I just drop some meta information into the head with a link to my Google Profile?

Enhanced by Zemanta

Comments are closed.