The two code fragments below will both be invisible for the user, but are parsed well in GSDTT.
<div>
<div itemtype="http://schema.org/WebPage" itemscope>
<div itemprop="mainEntity" itemtype="http://schema.org/Book" itemscope>
<meta itemprop="datePublished" content="2001-01-15" />
<meta itemprop="bookFormat" content="http://schema.org/Paperback" />
<link itemprop="image" href="http://rdf-translator.appspot.com/plato-cover.jpg" />
<meta itemprop="author" content="Plato" />
<meta itemprop="numberOfPages" content="224" />
<meta itemprop="inLanguage" content="English" />
<div itemprop="review" itemtype="http://schema.org/Review" itemscope>
<meta itemprop="name" content="Old is new again" />
<meta itemprop="reviewBody" content="A lovely read." />
<meta itemprop="author" content="O. Talp" />
<meta itemprop="datePublished" content="2001-01-16" />
</div>
</div>
</div>
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "WebPage",
"mainEntity":{
"#type": "Book",
"author": "Plato",
"bookFormat": "http://schema.org/Paperback",
"datePublished": "2001-01-15",
"image": "plato-cover.jpg",
"inLanguage": "English",
"numberOfPages": "224",
"review": [
{
"#type": "Review",
"author": "John Doe",
"datePublished": "2001-01-16",
"name": "O. Talp",
"reviewBody": "A lovely read."
}
]
}
}
</script>
Now consider the code below, which contains structured data wich is also visble to users; and it is parsed well in GSDTT:
<div itemtype="http://schema.org/WebPage" itemscope>
<div itemprop="mainEntity" itemtype="http://schema.org/Book" itemscope>
<p itemprop="datePublished" content="2001-01-15">Published: 2001-01-15 </p>
<p itemprop="bookFormat" content="http://schema.org/Paperback" />Format: Paperback </p>
<img itemprop="image" src="https://nl.wikipedia.org/wiki/Plato#/media/File:Plato_Pio-Clemetino_Inv305.jpg" >
<p itemprop="author" content="Plato" >Author: Plato</p>
<p itemprop="numberOfPages" content="224" >Pages: 224</p>
<p itemprop="inLanguage" content="English" >Language: English</p>
<div itemprop="review" itemtype="http://schema.org/Review" itemscope>
<p><strong>Review</strong></p>
<p itemprop="name" content="Old is new again" >Old is nieuw again</p>
<p itemprop="reviewBody" content="A lovely read.">A lovely read.</p>
<p itemprop="author" content="O. Talp">Author: O. Talp</p>
<p itemprop="datePublished" content="2001-01-16">Published: 2001-01-16</p>
</div>
</div>
</div>
I would prefer the last code fragment, because it contains structured data and produces visible output. Nevertheless microdata seems deprecated, or will be sooner or later. What would be best practice to produce structured HTML data that is also visible for users?
Microdata is not deprecated.
WHATWG has it specified as part of their Living HTML spec. W3C has it specified in a Note (with a new plan to publish it as Recommendation).
The Schema.org sponsors (still) support the three syntaxes JSON-LD, Microdata, and RDFa. They have no plans to deprecate any of these.
Consumers of Schema.org data might of course support only a subset of these syntaxes, or other ones. Unless you want to support a consumer that you know doesn’t support Microdata, there is no reason not to use it.
(By the way, the consumer Google recommends to use JSON-LD, but still supports Microdata and RDFa. There is no reason to follow their recommendation if Microdata/RDFa works better for you, unless you have to add it on the client-side with JavaScript).
Each syntax has its advantages and disadvantages (JSON-LD vs. Microdata vs. RDFa).
If you want to mark up your existing content (instead of duplicating the content), you have to use Microdata or RDFa. Either one should be fine for your case (Microdata vs. RDFa).
Related
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.
I'm new to code. I'm trying to add Structured Data code for Google reviews on my contact page:
http://www.catnips.co.uk/in-home-mobile-cat-groomer-feline-behaviourist.html
I am using the reviews from my Google Maps client reviews.
Testing it in Google Structured Data Testing Tool, it says
The attribute publisher.itemtype has an invalid value.
I can't work out what I'm doing wrong.
<div itemprop="review" itemscope itemtype="http://schema.org/Review">
<meta itemprop="author" content="Anita Kelsey">
<strong itemprop="itemreviewed">Mobile Cat Grooming</strong> by Jen Crothers<br />
<strong>My Rating:</strong> <span itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating"><img src="http://www.catnips.co.uk/wp-content/uploads/2014/09/5-stars-356x73.png" alt="5 stars" width="356" height="73" class="alignnone size-medium wp-image-4614" /><meta itemprop="ratingValue" content="5" /><meta itemprop="bestRating" content="5" /></span>
</div>
<span itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
Anita was absolutely brilliant with my Persian cat Ernie, who was a wriggly customer at times. She skillfully and gently removed the mats on his coat and gave him a very thorough groom. Brilliant, professional and easily a five star service provided from start to finish.
<meta itemprop="ratingValue" content="5" /><meta itemprop="bestRating" content="5" />
The error is not in the code you provided in your question body, but rather in the JSON-LD. In the Structured Data Testing Tool, you can click on an error to be taken to the line in the code that caused the error. This helps you identify what caused the problem.
The error is informing you that the itemtype you provided for the publisher property is invalid. Whilst schema.org does support the type Person for the publisher property of Article, Google does not. Google only supports Organization, not Person, as the type for the publisher property, as mentioned in the Articles Structured Data page on Google Developers.
You can fix error in settings: Yoast SEO > Search Appearance > Knowledge Graph > Choose Company or Person.
Of course you do! You just don't know it yet. ;) Try using this line:
"publisher":{"id":"http://www.catnips.co.uk/#organization"},
"baseSalary": {
"#type": "MonetaryAmount",
"currency": "EUR",
"value": {
"#type": "QuantitativeValue",
"value": 850,
"unitText": "MONTH"
}
}
Example is from http://schema.org/ImageObject
<div itemprop="exifData" itemscope itemtype="http://schema.org/PropertyValue">
<meta itemprop="name" content="Exposure Time">
<meta itemprop="value" content="1/659 sec.">
</div>
<div itemprop="exifData" itemscope itemtype="http://schema.org/PropertyValue">
<meta itemprop="name" content="FNumber">
<meta itemprop="value" content="f/4.0">
</div>
<div itemprop="exifData" itemscope itemtype="http://schema.org/PropertyValue">
<meta itemprop="name" content="MaxApertureValue">
<meta itemprop="value" content="2.00">
</div>
<div itemprop="exifData" itemscope itemtype="http://schema.org/PropertyValue">
<meta itemprop="name" content="Metering Mode">
<meta itemprop="value" content="Pattern">
</div>
<div itemprop="exifData" itemscope itemtype="http://schema.org/PropertyValue">
<meta itemprop="name" content="Flash">
<meta itemprop="value" content="Flash did not fire.">
</div>
These itemprop names and values are completely custom, right? My question is, is there a naming convention? Because MaxApertureValue in example is written as one word and in CamelCase, while Metering Mode is normal. Wouldn't it be better if I just put Aperture?
Yes, it’s up to the author which names (i.e., values for the name property) to use. Of course it makes sense to use standard names, should they exist.
In this example, the author marks up the Exif data exactly like it’s specified in the file:
<!-- We assume the following EXIF meta-data is available, but currently not shown:
Exposure Time: 1/659 sec.
FNumber: f/4.0
MaxApertureValue: 2.00
Metering Mode: Pattern
Flash: Flash did not fire.
-->
I don’t know Exif, but according to its Wikipedia article, the names seem to be written like that (i.e., MaxApertureValue, Metering Mode etc.).
So this is what consumers would likely expect for the exifData property.
I'm working with products that have pricing structures based on bulk-buy offers. For example, the pricing for a product may be as follows:
Buy 10-19 and the value of 1 is $3
Buy 20-29 and the value of 1 is $2
Buy 30-39 and the value of 1 is $1
Buy 40 or more and the value of 1 is $0.50
Minimum quantity available to purchase is 10.
How can I mark this up properly in structured data (Microdata format)?
Currently I have:
<span itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<meta itemprop="priceCurrency" content="USD"/>
<meta itemprop="price" content="3" />
<span itemprop="eligibleQuantity" itemscope itemtype="http://schema.org/QuantitativeValue">
<meta itemprop="minValue" content="10" />
<meta itemprop="maxValue" content="19" />
<meta itemprop="value" content="Number" />
</span>
</span>
For each variant. Then I have:
<span itemprop="priceSpecification">
<span itemprop="eligibleQuantity" itemscope itemtype="http://schema.org/QuantitativeValue">
<meta itemprop="minValue" content="10" />
</span>
</span>
On the product block itself, to indicate the minimum quantity of 10.
I'm really not at all confident this is the right structure and tags to use. Could anybody lend some insight?
You are missing the actual PriceSpecification items (as values for the priceSpecification property). UnitPriceSpecification seems to be the appropriate sub-type in your case.
So the structure could look like this:
<div itemscope itemtype="http://schema.org/Offer">
<div itemprop="priceSpecification" itemscope itemtype="http://schema.org/UnitPriceSpecification"></div>
<div itemprop="priceSpecification" itemscope itemtype="http://schema.org/UnitPriceSpecification"></div>
<div itemprop="priceSpecification" itemscope itemtype="http://schema.org/UnitPriceSpecification"></div>
</div>
Personally I would provide a UnitPriceSpecification for the first level (10-19), too, instead of providing its properties directly under Offer:
<div itemprop="priceSpecification" itemscope itemtype="http://schema.org/UnitPriceSpecification">
<p itemprop="eligibleQuantity" itemscope itemtype="http://schema.org/QuantitativeValue">
<span itemprop="minValue">10</span>-<span itemprop="maxValue">19</span>
</p>
<p>$<span itemprop="price">3</span> <meta itemprop="priceCurrency" content="USD"/></p>
</div>
But I don’t know if there aren’t some consumers out there that might expect it directly under Offer.
For a restaurant with two physical locations I am trying to add geo data to the rich snippets for both locations. When I add geodata for itemtype restaurant, the code validates, but then I can only add one location. Adding geo data in other parts results in errors like: Error: Page contains property "geo" which is not part of the schema.
I am trying to add this code:
<div itemprop="geo" itemscope itemtype="http://schema.org/GeoCoordinates">
<meta itemprop="latitude" content="37.7793" />
<meta itemprop="longitude" content="-122.4192" />
</div>
The code below is the complete rest of code which validates correctly. Any suggestions/comments are also very welcome.
<div itemscope itemtype="http://schema.org/Restaurant">
<span itemprop="name">Our Restaurant</span><br><br>
<meta itemprop="description" content="The best" />
<meta itemprop="servesCuisine" content="West European" />
<meta itemprop="menu" content="url/menu" />
<meta itemprop="paymentAccepted" content="Pin, Vpay" />
<meta itemprop="logo" content="link to logo" />
<meta itemprop="url" content="url" />
<meta itemprop="acceptsReservations" content="0123 12345678910">
<meta itemprop="email" content="info#myrestaurant.nl" />
</div>
<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<span itemprop="streetAddress">Address</span>,
<span itemprop="postalCode">12345</span>
<span itemprop="addressLocality">City</span><br><br>
<meta itemprop="telephone" content="01234 12345678910" />
</div>
<div itemprop="location" itemscope itemtype="http://schema.org/PostalAddress">
<span itemprop="streetAddress">Address1</span>,
<span itemprop="postalCode">54321</span>
<span itemprop="addressLocality">City1</span><br><br>
<meta itemprop="telephone" content="+10 12345678910" />
</div>
het, as your markup currently sits, you have three separate and independent schema types, and search engines will not be able to understand the relationship between them. First, you need to nest the PostalAddress type within the Restaurant schema type, like this:
<div itemscope itemtype="http://schema.org/Restaurant">
<span itemprop="name">Our Restaurant</span><br><br>
<meta itemprop="description" content="The best" />
<meta itemprop="servesCuisine" content="West European" />
<meta itemprop="menu" content="url/menu" />
<meta itemprop="paymentAccepted" content="Pin, Vpay" />
<meta itemprop="logo" content="link to logo" />
<meta itemprop="url" content="url" />
<meta itemprop="acceptsReservations" content="0123 12345678910">
<meta itemprop="email" content="info#myrestaurant.nl" />
<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<span itemprop="streetAddress">Address</span>,
<span itemprop="postalCode">12345</span>
<span itemprop="addressLocality">City</span><br><br>
<meta itemprop="telephone" content="01234 12345678910" />
</div>
</div>
You also need to use two separate Restaurant types, one for each location. You can show the relationship between the two by using either the "branchOf" property or the "subOrganizaiton" property. But each location must use its own Restaurant schema type and then the PostalAddress type must be nested within each.