Last updated November 24, 2011. Created by scor on November 23, 2011.
Log in to edit this page.

This tutorial describes how to build a listing of event pages and how to annotate them using the Schema.org module. The goal is to create a page that displays information for a list event which can be previewed in the Google Rich Snippets Testing Tool. We will use the Schema.org Event type which is one of the schema.org types recognized by Google.

Google Rich Snippet preview for a listing of events powered by Drupal 7, schema.org and RDFa

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: Setup and create event pages

First, please follow the previous recipe which explained how to setup an event content type with schema.org, and create a few events.

Step 2: Create a listing of events using Views

Next you need to create the list of events order chronologically. Install the Views module. It is a very popular modules and chances are you are already using it on your site.

Browse to Structure -> Views and add a new view. Fill the name "My listing of events", choose "Event" in the second drop down list type, and choose "Unsorted" in the sorted by drop down. Further, in the Display format section, choose Full posts in the second drop down. Click Continue & edit.

The base for your listing is ready. You only need to add a sort criteria on the field "Content: Date", and select the sort you prefer. Sort ascending will list the upcoming event first. Make sure to hit "Save" on the top right corner of your view. Then you can view your list of events by clicking on "View page". Those familiar with Views will be able to tweak the view to their liking. Tip: If you don't know how to use Views yet, you should check it out, it is very powerful :)

listing of events view

We have successfully added a schema.org type and properties to our Drupal page. The listing of events page can now be tested in the Google Rich Snippets testing tool, simply paste the URL of the node and hit preview.

Support

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

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.