Adding Schema.org Tags To A Site's Header: How And Which Schema?
Solution 1:
Update: The below answer is not fully correct. It is possible to express every Microdata within the head
element, there is no need for a parent item on the head
or html
element. For an example, see this snippet from my comment on a related Schema.org issue, which uses a style
element to create a top-level-item:
<head><styleitemscopeitemtype="http://schema.org/Thing"itemref="i1a i1b"></style><metaid="i1a"itemprop="name"content="Top-level item 1" /><metaid="i1b"content=""itemprop="image"itemscopeitemtype="http://schema.org/ImageObject"itemref="i1b-1a i1b-1b" /><metaid="i1b-1a"itemprop="name"content="Nested item 1" /><linkid="i1b-1b"itemprop="contentUrl"href="image.png" /></head>
Not a good practice, and it becomes chaotic because of all the needed itemref
/id
values, but it’s valid.
From the snippet you included in your question, only these elements contain Microdata:
<metaitemtype="http://schema.org/Product"itemscope="itemscope"/><metacontent="Cheap Flights | Cheap Flights to Europe | Ryanair"itemprop="headline"/><metacontent="Book Cheap Flights direct at the official Ryanair website for Europe's lowest fares. Fully allocated seating and much more now available online"itemprop="description"/><metacontent="/static/images/seo/seo-logo-200.png"itemprop="image"/>
This code is not valid, and not doing what they probably want to achieve.
If you want to provide Microdata only in the head
element (which wouldn’t make much sense, but let’s pretend) you need an element that can have child elements. Otherwise you can’t create a top-level Microdata item.
The only candidate is the head
element itself, so you could only provide one item in the head
, and it could have no properties that take another item as value. For properties you would use link
elements (if the value is a URI) and meta
elements (if the value is not a URI).
So it would have to be (omitting the headline
property, because it’s not allowed for Product
):
<headitemscopeitemtype="http://schema.org/Product"><metacontent="…"itemprop="description"/><linkhref="…"itemprop="image"/></head>
That’s pretty limited. So, if you want to use Microdata (or RDFa), you most likely want to make use of the whole document (html
, head
andbody
). The whole point of using Microdata/RDFa is to make use of your existing content, without having to duplicate it. If you don’t want to "annotate" your existing content, you could use JSON-LD and simply provide all properties in a script
element, e.g., in the head
.
About the missing name
property: If Google’s Structured Data Testing Tool says that a property is missing, it just means that Google won’t do something with your markup if it’s missing. It does not mean that the code would be invalid without it, as Schema.org has no required properties.
Post a Comment for "Adding Schema.org Tags To A Site's Header: How And Which Schema?"