Magnus
Magnus

Reputation: 18748

My Microdata doesn't validate: "The itemprop attribute was specified, but the element is not a property of any item."

I'm trying to validate a webpage with some Microdata in the Schema.org format, but I get a lot of errors of the type:

The itemprop attribute was specified, but the element is not a property of any item.

This is the general structure of my markup:

<div itemscope itemtype="http://schema.org/ProductModel" itemprop="mainEntity">
    <meta itemprop="productID" content="XYZ0001" />
    <meta itemprop="name" content="Product XYZ" />

    <table>
        <tr itemscope itemprop="additionalProperty" itemtype="http://schema.org/PropertyValue">
            <th><span itemprop="name">Foo</span></th>
            <td><span itemprop="value">1197</span></td>                                 
        </tr>
        <tr itemscope itemprop="additionalProperty" itemtype="http://schema.org/PropertyValue">
            <th><span itemprop="name">Bar</span></th>
            <td><span itemprop="value">Blah blah</span></td>                                    
        </tr>
    </table>
</div>

I'm using ProductModel and additionalProperty since the page entity doesn't have a more suitable predefined type (yet). Am I making any obvious mistakes in the markup?

Upvotes: 1

Views: 1272

Answers (1)

unor
unor

Reputation: 96587

If you specify itemprop on an element, there must be a parent element with itemscope.

Unless you have such a parent element not shown in the snippet, this is likely the line that gives the error:

<div itemscope itemtype="http://schema.org/ProductModel" itemprop="mainEntity">

I assume you want to convey that this ProductModel is the main entity of the web page, so you could specify:

<div itemscope itemtype="http://schema.org/WebPage">
  <div itemscope itemtype="http://schema.org/ProductModel" itemprop="mainEntity">
    <!-- … -->
  </div>
</div>

(Or one of the more specific sub-types, if applicable, e.g., ItemPage.)

Upvotes: 2

Related Questions