How to add authorship information for Facebook, Pinterest and Google on your blog

Authorship markup for sites used to be an exciting term back when Google was using it in the search results but has since faded back as Google decided that it’s not for everyone. Now it may make a come back as Facebook is now using it to help you get more followers and at the same time get you to add yet another Facebook URL in your code.

This is done through the article:author meta tag. When you add this tag in your HTML code and include your Facebook profile’s URL, Facebook will show your name as the author in articles shared from your blog. Additionally, your name will be linked to your profile, and if you have enable followers, people will see a “Follow” button as well.

How does one go about adding this information? In my case, I have Jetpack installed, which adds the tag already, linking to an automated archive page of all my posts. To override it, I added a small function in functions.php, provided by Jeremy Herve

function fb_custom_author_tag( $tags ) {
    if ( is_singular() ) {
        // Remove the link to Facebook Profile added by Jetpack
        unset( $tags['article:author'] );
        $tags['article:author'] = 'https://www.facebook.com/MYPROFILE';
    }
    return $tags;
}
add_filter( 'jetpack_open_graph_tags', 'fb_custom_author_tag' );

And that’s all there is to it. You can see the end result in the embedded post above.

If you don’t have Jetpack, you can add a simple function in functions.php like this

function custom_meta_author() {
 echo "<meta property='article:author' content='https://www.facebook.com/MYPROFILE'>";
}
add_action('wp_head', 'custom_meta_author');

Trial with adding author information
The Pinterest factor Looking into this I was reminded that Pinterest also uses Open Graph tags. For the author tag though, Pinterest breaks the OG rules and instead of a URL, it expects to find a name. I attempted to use an array of strings (supported by OG in the case of multiple authors), by having two strings, one with the Facebook URL and one with my name. That actually worked for Pinterest but Facebook rejected the code as invalid.

So my implementation stated as above, with authorship declared for Facebook only. That said, you show test how Pinterest parses your tags and enable the Rich Pins feature which improves how your articles show up on Pinterest.

Pin without the Rich Pins feature enabledWithout Rich Pins the same pin with Rich Pins enabledRich Pins enabled

And what about Google? Google has dropped authorship information as it found that it wasn’t very well for them. Instead they are now pushing for Rich Snippets, part of which are Social Profile Links

You can add it easily again with a small function

function custom_google_social_links() {
 echo '&lt;script type="application/ld+json"&gt;
 { "@context" : "http://schema.org",
 "@type" : "Person",
 "name" : "MY NAME",
 "url" : "http://MYBLOG.COM",
 "sameAs" : [ "https://www.facebook.com/MYPROFILE",
 "https://twitter.com/MYPROFILE",
 "https://plus.google.com/+MYPROFILE"]
 }
 &lt;/script&gt;';
}
add_action('wp_head', 'custom_google_social_links');

You can actually add more information about yourself, and eventually Google might pick it up and index it. That said, adding the code above doesn’t guarantee that Google will pick up and show your social links. Just do it and make a wish to the Google fairy…

All in all, we see that formats and standards are continuously changing. Depending on your audience and social media/marketing strategies, you can choose and adapt what kind of structured information you give out to social media networks and search engines.

Tags: , , , , , , , , , , ,