1

I'm trying to link a Brand to a Product with the following code:

<div itemscope itemtype="http://schema.org/Product" id="p2000">
...
   <meta itemprop="brand" itemscope itemtype="http://schema.org/Brand" itemref="v1437"/>
...
</div>

The Brand is already defined on the same web page above, inside an independant block:

<h1 itemscope itemtype="http://schema.org/Brand" id="v1437">
   <span itemprop="name">MyBrand</span>
   <meta itemprop="url" content="http://www.example.com/MyBrand"/>
   <meta itemprop="logo" content="http://www.example.com/MyBrand/logo.png"/>
</h1>

The validator can't find the name property inside the linked Brand object

Can't find 'name'

The link between a Brand and a Person seems to be working, but the Person object is not displaying the Brand's name:

Not displaying 'name'

I can use the itemref and id attributes on other objects. I can link Offers to Products and Offers to Persons using the same way.

Is this a bug from the validator?

1

itemref does not work like that.

You have to add the itemref attribute to the element you want to apply a property to, and this property has to be defined on an element with the matching ID.

So your example should be:

<div itemscope itemtype="http://schema.org/Product" itemref="v1437">
</div>

<h1 itemprop="brand" itemscope itemtype="http://schema.org/Brand" id="v1437">
   <span itemprop="name">MyBrand</span>
   <link itemprop="url" href="http://www.example.com/MyBrand"/>
   <link itemprop="logo" href="http://www.example.com/MyBrand/logo.png"/>
</h1>

(I changed two meta elements to link elements, which is required if the value is a URI.)

  • Thanks a lot, it's perfectly working but I would like to link the Brand to a Product and to an AggregateRating at the same time. I can't put both itemprop="brand" and itemprop="itemReviewed". Isn't there another way for that except duplicating the Brand item ? – Axel Isouard Sep 15 '15 at 8:29
  • Also, if I set an itemprop="WebPage" inside the body element, it tells me that it doesn't recognize the "brand" attribute. – Axel Isouard Sep 15 '15 at 8:32
  • 1
    New question : webmasters.stackexchange.com/q/85033/55879 – Axel Isouard Sep 15 '15 at 10:28
  • @AxelIsouard: Yeah, Microdata formally doesn’t allow to use properties that are not defined for a type (while RDFa and JSON-LD don’t disallow this), so you can’t use brand and itemReviewed together in Microdata -- And yes, if using itemref, you have to take care not to have this element as a child of a parent item (like WebPage) to which it doesn’t belong. It’s not always easy, and sometimes impossible, to achieve what you want with Microdata. – unor Sep 15 '15 at 19:47
0

i guess , that you get different Id's: in case of <meta itemprop="brand" itemscope itemtype="http://schema.org/Brand" itemref="v1437"/> is it v1437, in case of <div itemscope itemtype="http://schema.org/Product"></div> it will be p1437: thats why they aren't match and testing tool can't recognize them correctly

  • I have to name the Brand and Product differently, since I can't put two different elements with the same id. If they had the same id, the validator wouldn't recognize which one I would like to refer to. – Axel Isouard Sep 14 '15 at 14:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.