hAtom and Author Tags
hAtom and author tags are becoming an increasingly important part of SEO for a site. I’ve known for quite some time that I’ve been getting errors in places on my blog due to missing author tags. I see the errors in the Google Webmaster tools, but I didn’t have enough time last year to figure out why some pages seem to have this problem and others do not. Finally over the break I’ve been able to make a fix and thought I post it for others having similar issues with their WordPress theme.
What is hAtom?
Frankly I didn’t really know what the heck hAtom was. You can get good explanations here:
What Errors was I Seeing?
I was seeing errors in indexing from Google Webmsaster Tools and from Bing’s version of the same. You can see the error in the image I attached. The odd thing was that I was only getting the errors on a few pages and posts. All my posts are written by me – so that seemed odd. I looked at the source of pages and I seemed to have all the right tags, in this case a tag like this:
<span class=”post-author vcard author”>by <span class=”fn”>
<a href=”https://plus.google.com/107726310330175028060″ rel=”author”>Beren Erchamion</a>
In addition I seemed to have all the right google plus id’s and such in place. What really stumped me was why only a few pages…
Its All in the Theme
I took a much deeper look today and I noticed some interesting things:
- The current errors I’m seeing are only in pages not posts.
- I noticed that with posts specifically, I seemed to have different formats for the author name and Edit links.
Sure enough my theme (Graphene Theme) has different code for rendering a post vs. a page. Graphene has a php page called loop-single.php that is used for all pages except pages with a defined format. Pages are rendered with loop-page.php. A quick comparison of the code shows that they are different and that the single-page.php file is missing the needed tag above. I’m still not sure why Google and Bing don’t get an error for all my pages – they should, but anyway the fix is to add the code.
Graphene can have child themes. To make it easier with upgrades the best thing is to create a child theme. All you have to do is add a new folder to your themes folder called “graphene-child”. Then activate this theme. Copy the single-page.php file to the new folder and now you can add the needed code to this file, like this:
You could add similar code to all the other types too if you like, but I don’t use them so I won’t for now. With this done then there is one last thing to do. For the users writing the content you should go and make sure their profile has their full name selected as the displayed format – otherwise just the first name or nickname might get interpreted as their “fn”.
Test with the Best
With that done and a full cache flush on my site, now my pages are clean when tested with Google’s Structured Data Testing Tool. Now my pages are getting my full name and then family and given names properly formatted. Making this change also makes pages look more consistent with posts in that the author name is displayed in the same way.
Hopefully this helps you out if you are having similar issues – adding the code above should work for any theme. Child theme’s are a great way to customize your Graphene theme as well – I already had one to consolidate style changes and now here is another great reason to use a child theme.