"The property gtin12 is not recognized by Google for an object of type Text" - schema.org

I read some information from https://schema.org/identifier and https://schema.org/Text.
<div itemprop="identifier" itemtype="http://schema.org/Text" itemscope>
<meta itemprop="gtin12" content="{$product.upc}" />
</div>
Here in https://schema.org/Text property gtin12 is present, but I got this error in Google Schema tester:
The property gtin12 is not recognized by Google for an object of type Text.

Text is a data type. Data types aren’t supposed to be used as types like that.
If you want to add gtin12 to a Product, you don’t need to specify identifier (because gtin12 is a sub-property of identifier) nor Text (in Microdata, the content value is by definition a text value).
<!-- if the gtin12 should not be visible on the page -->
<article itemscope itemtype="http://schema.org/Product">
<meta itemprop="gtin12" content="{$product.upc}" />
</article>
<!-- if the gtin12 should be visible on the page -->
<article itemscope itemtype="http://schema.org/Product">
<p itemprop="gtin12">{$product.upc}</p>
</article>

Related

Microdata: Why does Google demand location for an event that is at a venue?

I have the following microdata HTML code:
<div itemscope itemtype="http://schema.org/PerformingArtsTheater">
<h2 itemprop="name">The Old Vic</h2>
<div itemscope itemtype="http://schema.org/TheaterEvent" itemprop="http://schema.org/event">
<h3 itemprop="name">Endgame</h3>
<div itemprop="startDate">2020-01-27</div>
</div>
</div>
I.e. : A PerformingArtsTheater called "The Old Vic" has an event, the TheaterEvent called "Endgame".
When an event is at a PerformingArtsTheater, which is a Place, I would think that is is obvious that the TheaterEvent's location is that same `PerformingArtsTheater`` ?
But Google's Structured Data Test Tool finds an error in the TheaterEvent: "A value for the location field is required.".
How come? Wouldn't a location field here be redundant at best, and a contradiction at worst?
(Like "February at The Old Vic: Endgame by Samuel Beckett at The Old Vic.")
Is there a way to please Gogle here, without introducing redundancy?
Thing > Event > TheaterEvent
TheaterEvent (Theater performance.) - location property expected Type place or more specific object like PerformingArtsTheater:
Thing > Place > CivicStructure > PerformingArtsTheater
In your case the PerformingArtsTheater is The Old Vic - the correct data structure outline:
Location (Required property for event snippet)
https://developers.google.com/search/docs/data-types/event
<div itemprop="location" itemscope="" itemtype="http://schema.org/PerformingArtsTheater">
<span itemprop="name">Theater name</span>
<meta itemprop="address" content="London, UK"/>
</div>
Put the location as PerformingArtsTheater property (Nested object)
<section itemscope="" itemtype="http://schema.org/TheaterEvent">
<h2 itemprop="name">Event Name</h2>
<div itemprop="startDate">2020-01-27</div>
<address itemprop="location" itemscope="" itemtype="http://schema.org/PerformingArtsTheater">
<p itemprop="name" content="Theater name">Theater name</p>
<meta itemprop="address" content="Bennelong Point, Sydney NSW 2000, Australia"/>
</address>
</section>
Result ==> No errors:
Google snippet preview (Add image, description and so on)
By the way this is great example of nesting schema.org objects.

How can you specify the subject matter of a blog post using Wikidata item URIs?

I would like to unambiguously describe (by using Wikidata URIs) what the subject matter of a blog post is using Schema.org.
Any pointers on how to do this?
You can use Schema.org’s about property:
The subject matter of the content.
While this property expects a Thing value, it’s possible to provide a URL value.
RDFa examples:
<article typeof="schema:BlogPosting">
<!-- URL value -->
<link property="schema:about" href="http://www.wikidata.org/entity/Q892" />
</article>
<article typeof="schema:BlogPosting">
<!-- Thing value -->
<div property="schema:about" typeof="schema:Person" resource="http://www.wikidata.org/entity/Q892">
<meta property="schema:name" content="J. R. R. Tolkien" />
</div>
</article>

ItemList with QuantitativeValue for table lists

I am trying to create a schema to use with several tables that use a list of products (e.g. bottles) arranged based on either height, volume, width, etc.
I tried this Microdata:
<div itemscope itemtype="http://schema.org/ItemList" id="id1">
<ul>
<li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
<meta itemprop="position" content="1" />
<span itemprop="item" itemscope itemtype="http://schema.org/Thing">
<span itemprop="name" class="name">Coke Bottle</span>
<span class="measure">
<span itemscope itemtype="http://schema.org/QuantitativeValue">
<span itemprop="value">2359</span>
<span itemprop="unitText">mm</span>
<meta itemprop="unitCode" content="MMT" />
</span> /
<span itemscope itemtype="http://schema.org/QuantitativeValue">
<span itemprop="value">92.52</span>
<span itemprop="unitText">in</span>
<meta itemprop="unitCode" content="INH" />
</span>
</span>
</span>
</li>
</ul>
</div>
The problem is that the measure is not associated directly with the product.
How can I structure this data using Microdata to maintain the measurement values using QuantitativeValue and make the ItemList work for my need?
These are just tables showing a list of product names ordered by these values either ascending or descending, they are not used for navigation, just presenting information based on aggregated data.
In your post I see the following contradictions:
The problem is that the measure is not associated directly with the product.
and
These are just tables showing a list of product names
However, if this is a product, you can use the following the valid markup for your list:
<div itemscope itemtype="https://schema.org/ItemList" id="id1">
<ul>
<li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
<meta itemprop="position" content="1" />
<span itemprop="item" itemscope itemtype="https://schema.org/Product">
<a itemprop="url" href=example.com/list.html#cokebottle><span itemprop="name" class="name">Coke Bottle</span></a>
<span class="measure" itemprop="additionalProperty" itemscope itemtype="https://schema.org/PropertyValue">
<span itemprop="value">2359</span>
<span itemprop="unitText">mm</span>
<meta itemprop="unitCode" content="MMT" />
<meta itemprop="propertyID" content="http://www.unece.org/fileadmin/DAM/cefact/recommendations/bkup_htm/add3lm.htm" /> /
<span itemprop="value">92.52</span>
<span itemprop="unitText">in</span>
<meta itemprop="unitCode" content="INH" />
<meta itemprop="propertyID" content="http://www.unece.org/fileadmin/DAM/cefact/recommendations/bkup_htm/add3hk.htm" />
</span>
</span>
</li>
</ul>
</div>
Here we used the guide of Google for Single, all-in-one-page list:
A single, all-in-one-page list hosts all list information, including full text of each item: for example, a gallery of recipes for various kinds of muffins, all contained on one page.
Note that the reference (s) for this markup must have the same URL, but different anchors such as #cokebottle in the above example. So it should be a list of all of which parts (and links to these parts) are installed on one web page.
Here we also use the type PropertyValue as embedded in the property additionalProperty. This property is part of the type Product so all markup is semantic relation and description for the specific product.
Also note that here we used the property propertyID with URL as the identifier of the value of this property.
You can’t associate a QuantitativeValue with a Thing.
The best practice is to use the most specific type available. In your case, this would be Product, or one of its sub-types, if it applies (IndividualProduct, ProductModel or SomeProducts).
This allows you to use the properties depth, height, weight, and width, all of which which can take a QuantitativeValue value.

How to code markup for Product in ItemList?

I have adapted a code taken from example 2 on http://schema.org/ItemList
How do I use it together with Product? On frontpage and some other pages I have a list of products for which I would like to have a better markup.
The following code gives the error
A value for the position field is required.
but Product doesn't have a position, so if there is a value for position it gives different error.
<ul itemscope itemtype="http://schema.org/ItemList">
<meta itemprop="numberOfItems" content="10" />
<li itemprop="itemListElement" itemscope itemtype="http://schema.org/Product">
<!-- <meta itemprop="position" content="1" /> -->
<a href="#" itemprop="url">
<img src="asdf.jpg" itemprop="image">
<div class="product-list__title" itemprop="name">
Product name
</div>
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<div itemprop="price">
$12
</div>
<link itemprop="availability" href="http://schema.org/InStock" />
</div>
</a>
</li>
</ul>
The itemListElement property has three expected values:
ListItem
Text
Thing
ListItem is also a Thing, but it’s listed explicitly because it has a special role here: ListItem provides the position property. If you need to convey the position of the list items, you have to provide ListItem values.
Note that not every ItemList needs this. Your example with using Product values is fine (apart from the meta element which can’t be a child of ul), and unless you try to qualify for Google’s rich result (this is what the error message is about), you could keep it like that.
If you do want to provide the positions, an itemListElement could look like this:
<li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
<meta itemprop="position" content="1" />
<div itemprop="item" itemscope itemtype="http://schema.org/Product">
<!-- your Product -->
</div>
</li>

Google Search Console and Testing Tool giving different errors about best/worst AggregateRating values

On Google Search Console, I'm getting the error missing best and worst rating. But when I tested the link on testing tool, I am getting:
Failed to normalize the rating value.
Your rating value was out of the default range, you must provide best and worst values.
The code is given below:
<h3>Reviews</h3>
<div class="average-rating" itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
<p class="rating-title">Average Rating</p>
<div class="rating-box">
<div class="average-value" itemprop="ratingValue">0/5</div>
<div class="review-amount" itemprop="ratingCount">0 rating</div>
</div>
When I change in rating value to
<div class="average-value" itemprop="ratingValue">0/5</div>
or to this
<div class="average-value" itemprop="ratingValue">0/-454545</div>
it gives a warning:
0 rating (The value provided for ratingCount must be an integer.)
How can I solve this?
The min/max attributes are plain HTML attributes, they don’t affect the Microdata (and they can, by the way, not be used on div elements).
In Schema.org, the worst/best rating can be specified with worstRating and bestRating. If you don’t provide these properties, "0" and "5" are assumed.
If you fix the other errors (ratingCount would have to be "0", not "0 rating"; and it might be better to use "0" instead of "0/5" as ratingValue), you could omit worstRating/bestRating. But it’s typically better to be explicit, so you could add:
<meta itemprop="worstRating" content="0" />
<meta itemprop="bestRating" content="5" />
or:
<meta itemprop="worstRating" content="0" />
<span itemprop="ratingValue">0</span>/<span itemprop="bestRating">5</span>