2017-07-07 64 views
2

有人可能會建議爲用戶可以購買某種產品的頁面添加正確的Schema.org標記的最佳方式嗎?我在那裏添加Product標籤(用於Rich Snippets)。Schema.org標記的'產品'內的問題和答案

我想增加提問的可能性,關於這個產品,但我沒有找到什麼屬性,我可以用作嵌入物品。

實施例:

<div itemscope="" itemtype="http://schema.org/Product"> 
    <meta itemprop="brand" content="Brand"> 
    <meta itemprop="url" content="URL"> 
    ...... 

    <div id="question1" itemprop=??????? itemscope="" itemtype="http://schema.org/Question"> 
     ...... 
     <div id="answer1" itemprop=??????? itemscope="" itemtype="http://schema.org/Question/Answer">....</div> 
     <div id="answer2" itemprop=??????? itemscope="" itemtype="http://schema.org/Question/Answer">....</div> 
    </div> 
    ... 
    <div id="question10" itemprop=??????? itemscope="" itemtype="http://schema.org/Question"> 
     ...... 
     <div id="answer1" itemprop=??????? itemscope="" itemtype="http://schema.org/Question/Answer">....</div> 
     <div id="answer2" itemprop=??????? itemscope="" itemtype="http://schema.org/Question/Answer">....</div> 
    </div> 
</div> 

回答

1

沒有屬性到Question添加到Product
但有一個屬性表明Question約爲Productabout

Microdata可以用不同的方式標記這種方式。下面是使用itemref一個例子:

<div id="product-42" itemprop="about" itemscope itemtype="http://schema.org/Product"> 
</div> 

<div itemscope itemtype="http://schema.org/Question" itemref="product-42"> 
</div> 

<div itemscope itemtype="http://schema.org/Question" itemref="product-42"> 
</div> 

要鏈接的AnswerQuestion,你可以使用suggestedAnswer/acceptedAnswer

+0

非常感謝!所以沒有辦法在Product div中包含問題div塊,因爲不幸的是我不允許更改html結構很多? –

+0

@尼卡德卡奇:有兩種方法。 1)你可以使用'itemprop-reverse'屬性(它不是Microdata規範的一部分)在另一個方向指定'about'。 2)你可以使用'itemid'來爲你的產品提供一個URI作爲ID,並使用這個URI作爲'about'屬性的值(例如,在'link'元素中)。 - 對於這兩種方法,您可以在[我對問題的回答* Microdata *中的獨立元素鏈接](https://stackoverflow.com/a/38663388/1591669)中找到示例。 – unor

+0

非常感謝@unor! –