Google Explains Why Sites Should Combine Structured Data via @sejournal, @martinibuster
Google explains why it's recommended to combine multiple structured data into one script The post Google Explains Why Sites Should Combine Structured Data appeared first on Search Engine Journal.
Google’s Lizzi Sassman answered a question in a Google SEO Office hours session about whether it’s okay to combine different structured data types.
The answer illuminated an important point about how Google interprets structured data and whether it’s better to combine structured data or two separate them out.
Combining multiple structured data is called nesting.
What is Nesting?
Structured data is basically about high level data types (called Types) and the attributes of those Types (called Properties).
It’s kind of like with HTML where the main HTML building blocks of a webpage are called Elements and every element has properties that modify them that are called “attributes.”
The HTML of a webpage begins by communicating that it’s an HTML webpage like this:
<HTML>Similarly, a structured data script begins by saying what the main structured data for the webpage is.
A recipe structured data on a webpage that is about a recipe looks like this:
<script type="application/ld+json"> { "@context": "https://schema.org/", "@type": "Recipe",Nesting is the addition of other structured data types within the main structured data.
So if the page is about Reviews, then the main structured data should begin like this:
<script type="application/ld+json"> { "@context": "https://schema.org/", "@type": "Review",But what about when the page is about a recipe and it has a review?
Do you create two structured data scripts?
Or do you combine the two structured data types?
Lizzi Sassman shares that there is a right and a wrong way to do it.
Is Combining Structured Data Allowed?
Structured data follows a logical set of rules. Once the rules are learned it’s easy to make sense of structured data.
This question is about the organization of structured data and how that impacts how Google interprets it.
This is the question that was asked:
“Is it allowed to add one structured data inside another type of structure data? For example, adding carousel structured data inside Q & A structured data.”
Lizzi Sassman answered:
“Yep. Nesting your structure data can help us understand what the main focus of the page is.
For example, if you put recipe and review at the same level, it’s not as clear as telling us that the page is a recipe with a nested review.
This means that the primary purpose of the page would be a recipe and that the review is a smaller component of that.
As a tip, always check the specific feature documentation to see if there’s any more notes about combining various structure data types.
Right now, the only supported carousel features are course, movie, recipe, and restaurant.”
Structured Data Tells Google What a Page is About
This is really interesting because what Lizzi is saying is that the structured data helps Google understand what a webpage is about.
But if you have two separate structured data scripts on the same webpage it makes it harder for Google to understand what the “focus” of the webpage is about.
She advises that it’s best to combine them so that the first part says what the webpage is about.
So if the webpage is about recipes, the structured data should start like this:
<script type="application/ld+json"> { "@context": "https://schema.org/", "@type": "Recipe",Google’s Search Central documentation about JSON-LD structured data discusses nesting:
“JSON-LD* (Recommended)
A JavaScript notation embedded in a <script> tag in the <head> and <body> elements of an HTML page.
The markup is not interleaved with the user-visible text, which makes nested data items easier to express, such as the Country of a PostalAddress of a MusicVenue of an Event.
Also, Google can read JSON-LD data when it is dynamically injected into the page’s contents, such as by JavaScript code or embedded widgets in your content management system.”
What the above quoted section from Google’s documentation means, in plain English, is that a webpage that is about a musical event (using the Event) structured data type, can also include additional data types for the music venue and the postal address.
The webpage in the above example is about an Event, not the venue of the event.
So the JSON-LD script that contains the Event structured data would begin like this:
<script type="application/ld+json"> { "@context": "https://schema.org", "@type": "Event",Event is a structured data type:
And the Postal Address for where the event takes place is also a structured data type:
Communicate the Focus of the Webpage
Sometimes it can feel like the “O” in SEO means optimizing a webpage for better rankings. But that’s not what search optimization is.
The “O” in SEO stands for means optimizing a webpage so that it’s easy for search engines to crawl and to understand what the webpage is about.
A webpage can’t rank without accomplishing those two optimizations.
Nesting structured data fits into that paradigm of “optimization” because it helps to make it clear what the focus of the webpage is.
Listen to the Google SEO Office Hours session at the 14:58 minute mark.
Featured image by Shutterstock/Asier Romero