Google+ authorship has been discontinued in favour of better author attribution methods but this post is still relevant for creating social links with node fields.

In Drupal 7, the MetaTag module has support for the Google authorship tags, or you could paste the code in your content or theme. For sites with a different structure, perhaps where the authors have custom content profiles and not user accounts, it may be that you need a different approach to enable dynamic social profile links. There are many ways to achieve this.

This solution uses three popular Drupal modules, Field (core), Views and EVA (Entity Views Attachment) as well as any modules required by those, and uses Node Reference or a similar method to create an author information pane with a teaser from a custom author profile content type. You should also be familiar with using Views. Using this method, fiddling with theme files for this field is not needed. You’ll just need to set the field to link to their G+ or other social profile page.

1. Create a new text Field for the content type that represents the author profile, this is where we will add the Google+ Profile link. You will likely want this field display to be hidden in the default and teaser displays as we’ll be using other methods to rewrite and display this field to create the correct author link, it is not enough to only have a plain link. You will need an author profile page to link correctly between it and the Google+ user profile in order to verify contributor status for that domain.

textfield

 

 

GplusEVA

 

2. In Views, we will create our first display that is an EVA Field.
Take care when editing your Display so that when it offers the selection of applying to all displays or overriding this display only, that you select the appropriate answer so that you don’t accidentally break your other displays which may be in the same View group. I’ve done this before, it sucks!

Edit your view:

GplusEva01
  • The Entity Type will be Node
  • The Bundle will be your custom Author content type
  • Show Title will be No
  • the Arguments can be id (default)

 

 

 

 

 

 

The Format, Fields and Filters would be similar to the below, as appropriate to your site:

GplusEva02

  • The format should display fields
  • The Fields should be the Author name (Title in my case), with this field Exlcuded from display, and G+ link field
  • The most important filter would be that the G+ link field is not empty.
We need to rewrite the Google+ Profile link similar to below:
<a href=”[field_google_author_id]?rel=author”>[title] on Google+</a>
GplusEva05
The Contextual Filter should be the Content: Nid.

If you have added at least one Google+ profile link to a profile, you can test that your View works in the View preview by adding the node id number of the profile with the link. You can find the Nid by hovering over the Edit button to see the node/xxx/edit link, where xxx is the Nid.

 

GplusEva04

When we have a working View, we can modify the EVA settings in the Author content type, Manage Display. Order the fields so that the EVA field displays where you like:

GplusEva06

And don’t forget to edit the Teaser view as well:

 

GplusEva07

Check your author page to be sure your new Google+ link displays, and check your author’s content to be sure the link displays there as well if you’re using the teaser as an author pane.

Test your author links by entering your page link to see how it will look in Google search results: http://www.google.com/webmasters/tools/richsnippets

Leah Davies
Join me

Leah Davies

An American living in England, Leah has extensive experience in website development, content management, community building, SEO and internet marketing since 1997.
Leah Davies
Join me

Latest posts by Leah Davies (see all)

Google+ Profile Link in Drupal 7 with Fields
Tagged on:         
Loading Facebook Comments ...
Loading Disqus Comments ...

Leave a Reply

Your email address will not be published. Required fields are marked *