Why does the Google structured data testing tool give error for an embedded item property? - schema.org

My code has markup for AggregateRating and it is embedded into a Product page that does not have its own Product markup. So I used the 'itemReviewed' property of my AggregateRating markup to specify the Product level data like so..
<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
<div itemprop="itemReviewed" itemscope itemtype="http://schema.org/Product">
<meta itemprop="name" content="Haley Lace Bralette">
</div>
</div>
The google structured data testing tool gives this error "One of offers or review or aggregateRating should be provided", but that error is being given for an AggregateRating element. Why is it asking for aggregateRating when it is already inside an AggregateRating element?

Related

"mainEntityOfPage" and "CreativeWork" usage on a web page of type "Organization"

I have a question regarding the correct use of the mainEntityOfPage, in this scenario:
The homepage of the site is of Organization type with name, description of the company, phone, address etc.
At the bottom of this page I have 3 snippets to 3 different articles published by this company.
So, I am trying to declare the homepage of Organization type, being the main topic of the web page. Also, I would like to declare using Schema.org that this company has written 3 different articles which are located on their own web pages. These snippets consists of headline of article, an introducing paragraph, a picture and a "read more" button.
I use the following code:
<body itemscope itemtype="http://schema.org/Organization" >
<a href="https://testsite.com/index.html" itemprop="url">
<img src="https://testsite.com/img/logo.jpg" itemprop="logo" alt="Company logo" />
</a>
<p itemprop="name">Company name</p>
<p itemprop="description">Company description</p>
<div itemprop="mainEntityOfPage" itemscope itemtype="https://schema.org/CreativeWork">
<meta itemprop="thumbnailUrl" content="https://testsite.com/img/article-1-picture.jpg" />
<p itemprop="headline">Article 1 headline</p>
<p itemprop="description">Article 1 first paragraph.</p>
<a itemprop="url" href="https://testsite.com/url-article-1.html">Read more</a>
</div>
<div itemprop="mainEntityOfPage" itemscope itemtype="https://schema.org/CreativeWork">
<meta itemprop="thumbnailUrl" content="https://testsite.com/img/article-2-picture.jpg" />
<p itemprop="headline">Article 2 headline</p>
<p itemprop="description">Article 2 first paragraph.</p>
<a itemprop="url" href="https://testsite.com/url-article-2.html">Read more</a>
</div>
<div itemprop="mainEntityOfPage" itemscope itemtype="https://schema.org/CreativeWork">
<meta itemprop="thumbnailUrl" content="https://testsite.com/img/article-3-picture.jpg" />
<p itemprop="headline">Article 3 headline</p>
<p itemprop="description">Article 3 first paragraph.</p>
<a itemprop="url" href="https://testsite.com/url-article-3.html">Read more</a>
</div>
</body>
The code above generates the following schema:
The code is valid with Structured Data Testing Tool.
I am afraid that using mainEntityOfPage here, 3 times, to introduce the article snippets would result into the situation that the search engine would wrongly consider my page of type CreativeWork rather than Organization type, which is the real main topic on this web page.
So, this code says to the search engine that the page is of Organization with 3 articles on separate pages, or only CreativeWork type?
Your structured data is not conveying what you intend to convey. It’s saying that the Organization is the primary entity on the three CreativeWorks.
So, I am trying to declare the homepage of Organization type, being the main topic of the web page.
For this, you need a WebPage item that represents the homepage.
<body itemscope itemtype="http://schema.org/Organization">
<div itemprop="mainEntityOfPage" itemscope itemtype="http://schema.org/WebPage">
<link itemprop="url" href="https://example.com/" /> <!-- the canonical URL of your homepage -->
</div>
</body>
I would like to declare using Schema.org that this company has written 3 different articles which are located on their own web pages.
For this, you need properties that say how the company and the articles¹ are related, like:
publisher
author
etc.
Note that, for example, publisher is only defined for one direction (an article has a publisher), not for the other one (an organization has published an article).² So you have to provide this property in the Article, not in the Organization.
<article itemscope itemtype="http://schema.org/Article">
<div itemprop="mainEntityOfPage" itemscope itemtype="http://schema.org/ItemPage">
<link itemprop="url" href="https://example.com/url-article-1.html" /> <!-- the canonical URL of the article page -->
</div>
<div itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<link itemprop="url" href="https://example.com/" /> <!-- the canonical URL of the organization’s homepage -->
</div>
</article>
¹ if they actually are articles, you should use the Article type instead of the parent type CreativeWork
² Microdata (in contrast to RDFa and JSON-LD) offers only a non-standardized way to use these properties in the other direction: see this answer

How to specify similar items in Schema.org?

Say I have place or business ( itemType = LocalBusiness ) and want to list its similar items (businesses) in page.
I want something like this:
<div itemscope itemType="https://schema.org/LocalBusiness">
<div itemprop="name">Biz Name</div>
<meta itemprop="image" content="image url" />
<div itemprop="description">Description</div>
.
.
.
</div>
<!--What should be the itemType of #other-similar-businesses to tell search engines these are Similar Items-->
<div id="other-similar-businesses" itemscope itemType="?" itemprop="?">
<div itemscope itemType="https://schema.org/LocalBusiness">
<div itemprop="name">Biz Name</div>
<meta itemprop="image" content="image url"/>
<div itemprop="description">Description</div>
.
.
.
</div>
<div itemscope itemType="https://schema.org/LocalBusiness">
<div itemprop="name">Biz Name</div>
<meta itemprop="image" content="image url"/>
<div itemprop="description">Description</div>
.
.
.
</div>
</div>
There is a sameAs property. According to schema.org :
URL of a reference Web page that unambiguously indicates the item's identity. E.g. the URL of the item's Wikipedia page, Freebase page, or official website.
But I don't know if it is suitable for this case.
What kind of type (and property if available) should I use?
Schema.org doesn’t provide a general property that conveys that a thing A is similar to a thing B. (The closest property is probably relatedLink, but this can only be used on WebPage items.)
Probably because that would be a rather useless relation, as things could be similar in many different ways. Instead, Schema.org tends to define more specific relations, e.g., containedInPlace/containsPlace if the places are located in another place (e.g., in the same city).
But I think your problem can be solved in a different way. If I understand your case correctly, you have a page about a single (e.g.) Restaurant item, and on that page you also link to pages that are about (somewhow related/similar) Restaurant items. Consumers should understand that one is the restaurant the page is about, and the other ones have their own pages.
mainEntity/mainEntityOfPage for the primary restaurant
Then you could make use of mainEntity (if you have a WebPage item) or the inverse mainEntityOfPage (see details). This allows you to convey which one of the many Restaurant items is the primary one, i.e., the one the page is about:
<body itemscope itemtype="http://schema.org/ItemPage">
<main>
<article itemprop="mainEntity" itemscope itemtype="http://schema.org/Restaurant">
<!-- primary restaurant -->
</article>
</main>
<aside>
<article itemscope itemtype="http://schema.org/Restaurant">
<!-- secondary restaurant -->
</article>
<article itemscope itemtype="http://schema.org/Restaurant">
<!-- secondary restaurant -->
</article>
</aside>
</body>
This doesn’t change that the secondary restaurants are top-level items, but this should not be a problem. There’s nothing bad about having multiple top-level items; it often can’t be prevented, because there aren’t suitable properties for all cases.
If you absolutely don’t want this, the hasPart property could be used for all Restaurant items. I don’t like this, because I don’t consider the secondary restaurants to be really part of the page, but strictly speaking, they are (i.e., in the form of teasers).
relatedLink for links to secondary restaurants
In case you don’t need structured data about the secondary restaurants on that page, you could of course simply link to them, by using the already mentioned relatedLink property:
<body itemscope itemtype="http://schema.org/ItemPage">
<main>
<article itemprop="mainEntity" itemscope itemtype="http://schema.org/Restaurant">
<!-- primary restaurant -->
</article>
</main>
<aside>
<ul>
<li><a itemprop="relatedLink" href="/r2">Restaurant 2</a></li>
<li><a itemprop="relatedLink" href="/r3">Restaurant 3</a></li>
</ul>
</aside>
</body>

How to implement Microdata for organization's product or service

If my company do it product (website, design, app), what should I apply Microdata to my HTML, if HTML structure look like below:
<div>
<h1>Company name</h1>
<p>Below is our portfolio</p>
<div itemscope itemtype="http://schema.org/???">
<h2>1. Website name</h2>
<p>Website info here...</p>
</div>
</div>
It depends on what this content is exactly about.
If it’s something your Organization offers (so the portfolio item is a placeholder for what your business offers), you could use:
makesOffer → Offer
If it’s something your Organization owns (so the portfolio item is something your business wants to show), you could use:
owns → Product
From the perspective of the CreativeWork, you could link to your Organization using the properties author/creator, contributor, copyrightHolder, provider, or publisher.
1- You can use, Like Unor said, the Organization, but there is some specific types of organizations.
You can use LocalBusiness and in your case, I will use another specific type of LocalBusiness wich calls https://schema.org/ProfessionalService. (provider)
An exemple of use :
<span itemscope itemtype="http://schema.org/ProfessionalService" style="display:none;">
<span itemprop="name">company name</span>
<span itemprop="description" style="display:none;">Description </span>
<img itemprop="logo" src="http://logo-url" alt="">
<span itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<span itemprop="streetAddress">Address</span>,
<span itemprop="addressLocality">Locality</span>
<span itemprop="addressCountry" >Canada</span>
<span itemprop="addressRegion">State_or_province</span>
<span itemprop="postalCode">Postal_code</span>
</span>
<span itemprop="geo" itemscope itemtype="http://schema.org/GeoCoordinates">
<meta itemprop="latitude" content="45.5354467" />
<meta itemprop="longitude" content="-73.505216" />
</span>
</span>
I advise you to use the GeoCoordinates, because Google should promote your web site in your local area.
You can hide this information for users by an style="display:none".
2- For your portfolio, you have another schema : CreativeWork
3- For the use of offer : you have to indicate the price that could be show directly in search results. But in your case, I don't think you want it :).
Microdata can change the appearance of your page directly in search results. For more information, Google Developers

how to use schema.org metadata on a review for multiple ratings?

I need to markup the review metadata for a product, but the review will have multiple ratings like service, satisfaction, quality, lifetime etc in the original schema.org documentation for review (http://schema.org/Review) there is only property/field: reviewRating using this i can only use it for one field but i need to provide metadata for all the fields, is there a solution for that?
Thanks.
Actually one property isn't an issue here since it can be used multiple times. There were a lot of discussions around cardinality of schema.org properties. You can dive into details here (issue at open tracker) and here (W3C Wiki page).
I personally follow the rule stated by Guha:
Right now, it is always allowed to have multiple values.
Another part of your question is how to describe different ratings. You can use mechanism of "multiple inheritance" like in "serious" programming language. That is one entity may have several types. In your case one type will be http://schema.org/Rating and another (quality, service, etc) you can get from any external to schema.org vocabulary. E.g., productontology is a good candidate (you can use http://www.productontology.org/id/Quality_philosophy, http://www.productontology.org/id/Customer_service accordingly). With RDFA you can just go with it - language itself provides all the necessary mechanisms to say that. But for microdata (and I bet you're using this one) you need to do "dirty hack" and use additionalType property.
So simple example of what you need is smth like this:
<div itemscope itemtype="http://schema.org/Review">
<span itemprop="name">Not a happy camper</span> -
by <span itemprop="author">Ellie</span>,
<meta itemprop="datePublished" content="2011-04-01">April 1, 2011
<div itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
<meta itemprop="additionalType" content="http://www.productontology.org/id/Quality_philosophy">
<meta itemprop="worstRating" content = "1">
<span itemprop="ratingValue">1</span>/
<span itemprop="bestRating">5</span>stars
</div>
<div itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
<meta itemprop="additionalType" content="http://www.productontology.org/id/Customer_service">
<meta itemprop="worstRating" content = "1">
<span itemprop="ratingValue">5</span>/
<span itemprop="bestRating">5</span>stars
</div>
<span itemprop="description">The lamp burned out and now I have to replace
it. </span>
</div>
And Google validator sees all the data.

Google SDTT error: "The review has no reviewed item specified."

I checked my website's Rich Snippets in the Google Rich Snippets Tool, and it had an error:
The review has no reviewed item specified.
How do I fix it?
The code is:
<div itemprop="aggregateRating" itemscope="" itemtype="http://schema.org/AggregateRating">
<span itemprop="ratingValue">5</span> stars - based on <span itemprop="reviewCount">21</span> reviews
</div>
The error message is pretty self explanatory with one of the problems that you have, but that's not the only problem with the code you presented. The other problem is that you've used itemprop without an item that this is the property of.
AggregateRating requires an item that is being rated. You can't have an AggregateRating without specifying what it applies to. There's two ways to do this (do not do both):
Use a containing item and specify the AggregateRating as a property. You (kind of) suggested this is what you are trying by using itemprop without a containing item. If you wish to use this, you need to wrap your itemprop in a suitable item. Suitable items are: Product, Brand, Offer, Event, Organization, Place, Service, CreativeWork. These items specify an aggregateRating property which can contain an AggregateRating.
<div itemscope itemtype="http://schema.org/Product">
<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
<span itemprop="ratingValue">5</span> stars - based on <span itemprop="reviewCount">21</span> reviews
</div>
<!-- other Product properties -->
</div>
Use the itemReviewed property of AggregateRating, specifying the Thing that the rating is regarding. Don't forget to remove the itemprop from the code in your question if you use this.
<div itemscope itemtype="http://schema.org/AggregateRating">
<span itemprop="ratingValue">5</span> stars - based on <span itemprop="reviewCount">21</span> reviews
<div itemprop="itemReviewed" itemscope itemtype="http://schema.org/Product">
<!-- Product properties -->
</div>
</div>
You have to use LocalBusiness schema for correct this one error.
I got the same error message for my page. Then I've put LocalBusiness Schema code after putting everything working fine.
For code sample, you can go on Schema page: http://schema.org/LocalBusiness
Or you can check my website which I have the correct one.
Didi Designer Studio