关于问题类型 QAPage 的架构警告 [英] Schema warning about QAPage on Question type
问题描述
我有一个包含多个问题和答案的页面,我在每个问题上都收到以下警告:
此项目应关联到的页面上缺少 QAPage 标记项目.
这是示例标记:
<h3 class="question" itemprop="name text">这是问题吗?</h3><div class="answer" id="IdForTheAnswer" itemprop="acceptedAnswer" itemscope="" itemtype="http://schema.org/Answer"><div itemprop="文本"><p>这是答案文本.</p>
<小时>
以下是来自 https://search.google.com 的示例警告/结构化数据/测试工具/:
问题 |0 错误 |1 警告@类型- 问题- 名称- 这是问题?- 文本- 这是问题?- 接受的答案- @类型- 回答- @ID- https://www.example.com/IdForTheAnswer- 文本- 这是答案文本.警告- 此项目应关联到的页面上缺少 QAPage 标记项目.
<小时>
这个警告实际上要求我提供什么?
到目前为止我尝试失败的方法:
- 从
acceptedAnswer
中删除 - 使用
suggestedAnswer
而不是acceptedAnswer
- 为
Question
提供一个mainEntityOfPage
id
好吧,经过一整天的尝试,我终于偶然发现了答案.
如果我删除了除问题项之外的所有内容,我也会收到同样的警告,所以这与此有关.我尝试了很多方法,但凭直觉我最终将整个问题集中在此:
<!-- 其余的问答标记-->
现在我得到了有效的架构,没有任何错误或警告.
我觉得文档和错误信息不是很好,或者我只是不了解这个生态系统及其资源!
附言我还尝试了 QAPage
项目类型,但这需要更多的道具并且实际上并没有描述我正在构建的页面,所以 FAQPage
最接近.
I have a page with multiple Question and Answers and I'm getting the following warning on each question:
Missing a QAPage markup item on page to which this item should be associated.
This is example markup:
<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>
And below is the example warning from 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.
What is this warning actually asking me to provide?
What I've tried unsuccessfully so far:
- Remove the
id
from theacceptedAnswer
- Use
suggestedAnswer
instead ofacceptedAnswer
- Provide the
Question
with amainEntityOfPage
Ok so after an entire day of trying I finally stumbled on the answer.
I was getting that same warning if I removed everything but the question item, so it's something related to that. I tried a lot of things and on a hunch I ended up wrapping the whole collection of questions in this:
<div itemscope itemtype="http://schema.org/FAQPage">
<!-- Rest of Q&A markup -->
</div>
And now I get valid schema without any errors or warnings.
I feel like the documentation and error messages are not very good, or I just don't understand this ecosystem and its resources yet!
p.s. I also tried the QAPage
itemtype but that requires a lot more props and doesn't actually describe the page I'm building, so FAQPage
comes closest.
这篇关于关于问题类型 QAPage 的架构警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!