I am trying to add the schema.org meta tags to my product pages - having offers and ratings etc.

The code below works fine and I'm able to test it google rich snippet tool.

<div itemscope itemtype="http://schema.org/Product">
    <div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
       <meta itemprop="ratingValue" content="5">
       <meta itemprop="reviewCount" content="20">
    </div>

    <div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
       <span itemprop="price">Rs.100</span>
    </div>
</div>

Now I have a video of this product on this page and based on the page layout - it is positioned above the price. So when I insert the videoobject as shown below - the google rich snippet tool throws an error saying

Error: Page contains property "video" which is not part of the schema

This is the shorter version of the full code which gives the error.

   <div itemscope itemtype="http://schema.org/Product">
    <div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
       <meta itemprop="ratingValue" content="5">
       <meta itemprop="reviewCount" content="20">
    </div>

    <div itemprop="video" itemscope itemtype="http://schema.org/VideoObject">
       <meta itemprop="name" content="Hello World"/>
       <meta itemprop="duration" content="T1M33S" />
       <meta itemprop="thumbnailUrl" content="v2.jpg" />
       <meta itemprop="contentURL" content="www.viddler.com/player/xyz"/>
       <meta itemprop="embedURL" content="http://viddler.com/flash/publisher.swf?key=xyz"/>  
       <meta itemprop="description" content="Hello world"/>
    </div>

    <div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
       <span itemprop="price">Rs.100</span>
    </div>
</div>

Now if I remove the video object and put it outside the product tag - its valid. But the way my page is structured - the video will appear within the product tag.

I can close the product tag - start the video tag - close the video tag and then open another new product tag - but then it will show as 2 different products.

Any idea how I should go about this.

Thanks

有帮助吗?

解决方案

http://www.schema.org/Product doesn’t define the property video.

  • You could omit itemprop="video".
    Drawback: The video is not associated with the product.

  • You could use the property description instead.
    Drawback: the expected type is "Text" (but see Expected types vs text in the schema.org documentation).

  • You could use itemref to split your markup into two parts without creating two products, leaving the video out of the product item.
    Drawback: The video is not associated with the product.

其他提示

Just in case anyone stumbles across this looking for an answer to the question like I was. I'm not sure if this has changed since the original question was answered, but here is an up-to-date Jan 2018 answer.

According to schema.org (see http://schema.org/Product) CreativeWorks (of which VideoObjects are a type of) can be referenced from within a product with the use of itemprop="subjectOf" instead of itemprop="video". See the example below. This should work with Google's Structured Data Testing Tool.

<div itemscope itemtype="http://schema.org/Product">
  <img itemprop="image" src="dell-30in-lcd.jpg" alt="A Dell UltraSharp monitor" />
  <span itemprop="name">Dell UltraSharp 30" LCD Monitor</span>
  <div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
    <span itemprop="ratingValue">87</span> out of <span itemprop="bestRating">100</span> based on <span itemprop="ratingCount">24</span> user ratings
  </div>
  <span itemprop="offers" itemscope="" itemtype="http://schema.org/Offer" class="price-excluding-tax">
        <meta itemprop="availability" href="http://schema.org/InStock">
        <meta itemprop="itemCondition" content="http://schema.org/NewCondition">
        <span itemprop="priceSpecification" itemscope="" itemtype="http://www.schema.org/PriceSpecification" id="price-excluding-tax-1003">
            <span class="price-currency" itemprop="priceCurrency" content="GBP">£</span> <span class="price" itemprop="price" content="999">999.00</span>
  </span>
  </span>
  <div itemprop="subjectOf" itemscope itemtype="http://schema.org/VideoObject">
    <meta itemprop="duration" content="PT1M7S" />
    <meta itemprop="name" content="Opera® ProSafe Hospital Profiling Bed" />
    <meta itemprop="description" content="The Opera® ProSafe is the flagship bed from the Opera® range. Its extra low height and high nursing height makes the bed an all-in-one bed, eliminating the need to use low profiling and standard profiling beds separately. The Opera® ProSafe accommodates up to a 10” mattress, allowing the bed to be used with deep airflow mattresses and comply with the BS EN 60601-2-52:2010 medical beds standard."
    />
    <meta itemprop="thumbnailUrl" content="https://alpinehc.co.uk/media/import/prosafe-video-thumbnail.png" />
    <meta itemprop="contentURL" content="https://vimeo.com/232354348" />
    <meta itemprop="embedURL" content="https://player.vimeo.com/video/232354348" />
    <meta itemprop="uploadDate" content="2017-09-04T11:37:00+08:00" />
    <meta itemprop="height" content="340" />
    <meta itemprop="width" content="190" />
    <iframe src="https://player.vimeo.com/video/232354348?api=1&amp;player_id=player1&amp;autoplay=1&amp;loop=1" height="240" width="320"></iframe>
  </div>
</div>

Adding one more option to what unor already said.

You may consider your video as kind of review (overview of the product). You can even say (depending on your actual web page) that AggregateRating (you have in code)+reviews for it+video are all parts of this broad Review. Then markup may look like this:

  <div itemscope itemtype="http://schema.org/Product">
    <div itemprop="review" itemscope itemtype="http://schema.org/Review">
        <div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
           <meta itemprop="ratingValue" content="5">
           <meta itemprop="reviewCount" content="20">
        </div>

        <div itemprop="video" itemscope itemtype="http://schema.org/VideoObject">
           <meta itemprop="name" content="Hello World"/>
           <meta itemprop="duration" content="T1M33S" />
           <meta itemprop="thumbnailUrl" content="v2.jpg" />
           <meta itemprop="contentURL" content="www.viddler.com/player/xyz"/>
           <meta itemprop="embedURL" content="http://viddler.com/flash/publisher.swf?key=xyz"/>  
           <meta itemprop="description" content="Hello world"/>
        </div>
    </div>

    <div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
       <span itemprop="price">Rs.100</span>
    </div>
  </div>
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top