我有一个包含多个问题和答案的页面,并且每个问题都收到以下警告:
Missing a QAPage markup item on page to which this item should be associated.
这是示例标记:
<div itemscope="" itemtype="http://schema.org/Question">
<h3 class="question" itemprop="name text">This is the question?</h3>
<div class="answer" id="IdForTheAnswer" itemprop="acceptedAnswer" itemscope="" itemtype="http://schema.org/Answer">
<div itemprop="text">
<p>This is the answer text.</p>
</div>
</div>
</div>
以下是来自https://search.google.com/structured-data/testing-tool/的警告示例:
Question | 0 ERRORS | 1 WARNING
@type
- Question
- name
- This is the question?
- text
- This is the question?
- acceptedAnswer
- @type
- Answer
- @id
- https://www.example.com/IdForTheAnswer
- text
- This is the answer text.
warning
- Missing a QAPage markup item on page to which this item should be associated.
此警告实际上要求我提供什么?
到目前为止我没有尝试过的事情:
id
移除acceptedAnswer
suggestedAnswer
代替acceptedAnswer
Question
提供mainEntityOfPage
答案 0 :(得分:4)
好吧,经过一整天的尝试,我终于迷失了答案。
如果我删除问题项以外的所有内容,我将收到相同的警告,因此与此相关。我尝试了很多事情,但凭直觉我最终将所有问题包装在其中:
<div itemscope itemtype="http://schema.org/FAQPage">
<!-- Rest of Q&A markup -->
</div>
现在我获得了有效的架构,没有任何错误或警告。
我觉得文档和错误消息不是很好,或者我只是不了解这个生态系统及其资源!
p.s。我还尝试了QAPage
项目类型,但这需要更多的道具,并且实际上没有描述我正在构建的页面,因此FAQPage
最接近。