Structured Data for Events

In this video I’ll show you how you can create Structured Data for Events that produce a Rich Snippet in search results.

Links from the Video:


Transcript:

Introduction

In this video I want to demonstrate how to build an event snippet using structured data. This is for everyone who works with events a lot.

music playing

Hi and welcome back! Nice to have you in the fourth lesson of module 3 of my structured data training. I am Florian, the developer of SNIP, the Rich Snippets and Structured Data Plugin for WordPress.

If you want to use the plugin please feel free to follow the link that you can find in the description area.

In this video I want to show you how an event snippet is built. You hopefully took all the lessons from the previous modules. If not, please jump back to the beginning or to a video where you think you need to refresh your knowledge. In this video it’s important that you have understood what Structured Data is and what Rich Snippets are. You need to know how and where you can find the right schema classes as well as their properties to create an event schema.

Let’s jump right in!

Check the references

As always we open up the event page on Google’s reference to see:

A) how a Rich Snippet for an Event may look like in search results;

B) what you should do and should not do. And be really serious about that! If you do violate Google’s policies – that means the technical as well as the content guidelines – your markup might not show up in search results.

And C) last but not least – what properties are totally necessary and which ones are just recommended.

This is the page where you find this document. Look it up, read through, and then follow me to the next page.

As always Google uses Structured Data from schema.org. On schema.org/Event you can find all properties that are possible for this schema type. However as you could see on Google’s reference page: you don’t need every single property listed there. You only need the required ones to get a Rich Snippet in search results. However I highly recommend to add as much properties as you can. I will explain later why I recommend this procedure.

On schema.org an Event is a CreativeWork which is a Thing. If you don’t know what I’m talking about right now please go back to module one of my Structured Data Training. It will be explained in full detail how schema.org is structured.

As you can see here, an Event has a few child schemas that you can also use. Search engines understand that all of them are children of the mother schema named “Event”. So if you want to use the Festival schema because you think it fits best for your purpose, please feel free to use it. Search engines also have a deep understanding of all the schemas found on schema.org. So they understand that the Festival schema is an Event, too.

As you can see here the Event schema and all of its child schemas can have thousands of properties. However you don’t need every single one to get a Rich Snippet in search results as I said before. But as always: you can add more if you can fill the properties properly. I’m sure that Google and other search engines will mark more and more properties as mandatory in the future because they did this a lot during the last months. To keep this video as short as possible I will stick with the recommended ones.

How to add an Event using Structured Data

Alright! Let’s get started! In the video I will use the built-in generator in SNIP my Rich Snippets and Structured Data plugin for WordPress. If you don’t have the plugin please feel free to use the structured data generator on my website to follow the video instructions. The free generator does not have all the features the built-in generator has. So it might be that you get stuck at some point. Especially when it comes to Global Snippets that allow you to automate structured data generation.

Let’s begin!

I am now in the WordPress dashboard specifically in the Global Snippets menu here. As you may know from one of the previous videos, Global Snippets allow you to create one snippet and attach it to every post defined by certain rules. So in my case I want to create one Global Snippet and attached it to all my event posts.

As you can see I have a separate post type called “Events” that I use on this WordPress site. SNIP comes shipped with some predefined Global Snippets that are ready-to-use for certain purposes. For example the product snippet that you can use if you are working with WooCommerce a lot.

Create a Global Snippet

Unfortunately there is no event snippet right now but I’m sure that this will be added in the near future as well. Because there is no Global Snippet for Events I need to create one. For this I click on the “Add new Global Snippet” button here on the top.

Now, first of all, I enter a title. It doesn’t matter what you enter here because its just used for internal purposes. I will just enter “Event”. Second, you can click the “Event” button here to show the plugin that the main Thing should be the Event schema. SNIP then intelligently loads some properties that you might need. Of course it can be that you don’t need everything here. In this case you can always delete – or down below – search for another property that has not yet been added.

Find the right properties

Before we start filling everything with values we need to look up what properties are required for Google to get a Rich Snippet in search results. For this I have opened up the page in a second tab already. When you scroll down you see a table that lists all required properties and down below you can see all recommended properties. We will see later that missing properties that are required will produce a red error message on Google Structured Data Test Tool. Whereas, missing properties that are just recommended will produce just an orange warning. Okay let’s go back to our Global Snippet.

Because Google’s reference says that we only need the location, the name and the startDate property, I will delete the other ones for now. However – as I said before – you should, if you can, add as much properties as possible as it might be that Google changes the list of required properties in the future. And if they do this Googles Structured Data Test Tool would produce an error and if you miss it, your Rich Snippets would disappear. So to be prepared you should fill as much as you can. To keep the video short I will stick with the three properties and just delete the other ones.

Fill the values

Now I switch back to the reference to see what values Google expects for properties. Or for the required properties. I can read from the table that the location here should be a nested Place schema. That table also says that the address property within the Place schema is required. I can also see that the nested address property within the Place schema needs the following properties: streetAddress, addressLocality, etc. For the name Google expects just normal text and for the startDate either a DateTime schema or.- way easier – just at a specific time in a specific format.

I have decided to just use a normal text value for the date. I marked this property as overrideable so that I can change its value in each post separately. The name of the event should be my post title so I choose “post title” here and for the location property we need a nested schema and that is the Place. So I’m searching for the Place. The plugin does then load all the properties we need and we have to mark them as overrideable a as well as the address is different for every event. So I open up a overridable for each property.

Define where is snippet should appear

Now everything is done. Only one step is missing: we need to choose where this Global Snippet should appear. And as I said before, I wanted to use it on all of my Event posts. So I choose “post type is equal to events”. That’s it!

I will save this or publish it directly.

Create an Event snippet from a post

Now we need to make sure we can edit Global Snippet values on our custom post types or custom post type. So I go to SNIP and SNIP -> settings. And I select “events” here as well. Don’t forget to save your changes!

Okay then I go to Events and as you can see I have prepared one event already. If I open it up you can recognize very quickly where and when this event takes place. However for search engines it’s not that easy because all this data is not in a machine-readable format. That’s why we need to output Structured Data in the source code of the page only for the search engines.

Edit overridable values on the Global Snippets Window

To do that you can click on the Global Snippets button on the right side or you can also find it here down below. This will then open up a new window and you can find – or we can find – our just newly created event on the left side and then we click on it. This will then load all properties that we have marked as overrideable.

Now I have filled all the values. You should read through the descriptions for each property to learn how the values should look like. The descriptions are from schema.org and they tell you that for example the addressCountry must be in typical two-letter format we all know. So for Germany that would be DE.

After that we save our settings. Close this window. And – yeah – update this post again.

Test your Structured Data

Now we can head over to Googles Structured Data Test Tool and enter the URL of our newly created event post here. Because I’m on a test site that is not reachable from the internet I need to copy and paste the generated code manually. OK.

And I run the test.

Oops! Lots of errors! But that’s good because you can now learn how errors are fixed. Let’s go through it quickly. Google says that “streetAddress, addressCountry, addressRegion and so on is not recognized by Google for an object of type Place”. What went wrong?

If we check the reference page again you can see that I have used the wrong properties on the wrong schema. The place needs a property named address and this property needs to be a PostalAddress schema but on my snippet it’s totally different.

Re-Configure your Global Snippet to prevent errors

So let’s open up our Global Snippet again. I edit the event. And now Place is right but the properties are wrong. So I delete them. And I’m searching for address. And the address must be the PostalAddress. So now I have the same properties again. Mark them overridable again. And now, as you can see, we have the structure Google wants to see. The location property is now a Place and the address property is a PostalAddress. All right! Update.

And now I need to edit the structure here again. Alright. Save the settings. And then. Check it again. After rerunning the test again the errors on the address went away. However we still have some errors left. Or warnings. If you pay attention; if you paid attention on the video, you maybe saw that I have included the endDate instead of the startDate. So I need to correct this as well. When we check the reference again you can see that the startDate is a required property.

So I go back to Global Snippets and edit the event snippet again. And I’m now searching for the startDate. A click on it will add it. And I’ll just do one thing: I mark this as overridable again. Update.

Then I go again back to my event and edit my snippet. I will delete the endDate because I don’t want the endDate to appear. And I add the startDate instead. Save.

Re-Test the snippet again

So I paste the new code. Run the test again. And now the errors went away but we still have warnings. As I’ve mentioned before warnings are not errors. They do not prevent your snippet from creating a Rich Snippet in search results. However you should add a value to these properties if you can. Sometimes that’s not possible. That’s why the tool says “please provide a value if available”.

Conclusion

All right. Let’s sum everything up what we have learned in this video.

  • At the time of the making of this video the event snippet shows up a list of events found on a page. Each event shows the name, the date and the venue of the event.
  • I have explicitly mentioned the festival schema in this video but the event schema has a lot more child schemas that you can also use.
  • To find the right properties use Google’s reference pages to learn more what you should and should not do. Use schema.org to integrate more properties. I totally recommend to use as many properties as possible.
  • Automate as much as you can by setting up a Global Snippet as shown in this video using SNIP, my Rich Snippets and Structured Data Plugin.

In the next video I will show you how to create a Product snippet. That is especially interesting for everyone who sells products on websites. See you in a bit!

music playing