This tutorial describes how to build pages describing people and how to annotate them using the Schema.org module. In this tutorial we will create a page that displays information for a specific person, and we will preview it in the Google Rich Snippets Testing Tool. We will use a content type in this use case, but the same can be achieved by adding fields to the regular user account at Administration » Configuration » People » Account settings » Manage fields.

Google Rich snippet preview of a person powered by the schema.org Drupal module and RDFa

We will use the Schema.org Person type which is one of the schema.org types recognized by Google. You can see this tutorial in action in the Drupal schema.org module screencast.

Background Information

schema.org is a collaboration of Google, Yahoo! and Bing to standardize the way structured data is added to web pages. The schema.org vocabulary includes descriptive terms for content like movies, people, organizations, events, locations, etc. The goal is "to improve the display of search results, making it easier for people to find the right web pages."

Step 1: Install required modules

This tutorial uses the schema.org. Learn how to install a contributed module in Drupal 7.

Step 2: Create a new content type with schema.org settings

Go to Structure -> Content Types -> Add content-type and create a content type with the following name and description:

  • Person
  • Person that uses schema.org Person Type and Properties

In this tutorial we're not going to worry about any content-type settings other than the Schema.org Settings. Click on 'Schema.org Settings' near the bottom of the page, and fill in a type in the autocomplete field. When you start to type the word 'person' a dropdown list will be displayed and will list all possible Types. Select 'Person'. Note that if you use user profiles instead of a content type, this step is not necessary because the schema.org type Person is automatically set for all user profiles.

Click 'Save and add fields'

Field settings

Now we'll add some fields and assign them various schema.org properties.

On the Manage Fields tab of your person content type, create a new field called 'Image' and select of the image formats in the field type drop down list. On the next form, click Save field settings. At the bottom of the next form, enter 'image' for the schema.org mapping and click Save settings.

Repeat the same procedure for the creation of the 'Affiliation' field of type text, which will be mapped to the schema.org 'affiliation' property.

Repeat the same procedure for the creation of the 'Job title' field of type text, which will be mapped to the schema.org 'jobTitle' property.

Here is a run down of the schema.org mappings:

Field Schema.org mapping
type Person
Image image
Affiliation affiliation
Job title jobTitle

Note that these are the fields Google requires to generate a preview. Make sure to have the right mappings on all these fields for the preview to work. You can change the field names as long as the schema.org mappings are correct, for example the 'Image' field could be called 'Photo' as long as the schema.org mapping is image.

The Person content type is now listed under: Structure -> Content type.

Step 2. Add content using the Person content type.

We'll use Dries Buytaert in this example. Go to Add content -> Person.

Enter the following information in the appropriate fields:

  • Title: Dries Buytaert
  • Image: upload any image
  • Affiliation: Acquia
  • Job title: Co-founder & CTO

Click 'Save'.

If everything went as planned a node about Dries should have been created. The page can now be tested in the Google Rich Snippets testing tool, simply paste the URL of the page and hit preview.

Support

If you experience difficulties setting up your content type, or if it cannot preview it correctly in the Google Rich Snippets testing tool, please file a support request in the schema.org module issue queue.

Comments

comcomcom’s picture

Thanks, great post. How do you know which fields google requires to generate a preview?

mototribe’s picture

Can you use it for D7's user object?

scor’s picture

@comcomcom: if some required fields are missing, the Google testing tool will tell you what fields are required.

scor’s picture

@mototribe: yes, absolutely, I just updated the documentation above to reflect that. It's basically the same as for a content type, just that you can skip the type Person step.

PascalAnimateur’s picture

There seems to be no way of specifyng the person's image from the user picture provided by Drupal. Am I missing something?