问答 (QAPage
) 结构化数据
问答网页是包含问答格式数据(先列出一个问题,后跟相应的答案)的网页。对于表示问题及相应答案的内容,您可以使用 schema.org QAPage
、Question
和 Answer
类型标记数据。
如果您正确标记了网页,Google 就会在搜索结果页上为其显示富媒体搜索结果。这种富媒体搜索结果处理方式有助于您的网站通过 Google 搜索覆盖合适的用户。 例如,如果用户查询“如何取出卡在 USB 端口中的数据线?”,而提供此问题答案的网页已加上标记,就可能会显示该查询的富媒体搜索结果。
除了能够使系统对您的内容采用富媒体搜索结果处理方式之外,标记问答网页还有助于 Google 为该网页生成更好的摘要。如果未显示富媒体搜索结果,那么答案的内容可能会出现在基本搜索结果中。
如何添加结构化数据
结构化数据是一种提供网页相关信息并对网页内容进行分类的标准化格式。如果您不熟悉结构化数据,可以详细了解结构化数据的运作方式。
下面概述了如何构建、测试和发布结构化数据。如需获得向网页添加结构化数据的分步指南,请查看结构化数据 Codelab。
- 添加必要属性。根据您使用的格式,了解在网页上的什么位置插入结构化数据。
- 遵循指南。
- 使用富媒体搜索结果测试验证您的代码,并修复所有严重错误。此外,您还可以考虑修正该工具中可能会标记的任何非严重问题,因为这些这样有助于提升结构化数据的质量(不过,要使内容能够显示为富媒体搜索结果,并非必须这么做)。
- 部署一些包含您的结构化数据的网页,然后使用网址检查工具测试 Google 看到的网页样貌。请确保您的网页可供 Google 访问,不会因 robots.txt 文件、
noindex
标记或登录要求而被屏蔽。如果网页看起来没有问题,您可以请求 Google 重新抓取您的网址。 - 为了让 Google 随时了解日后发生的更改,我们建议您提交站点地图。Search Console Sitemap API 可以帮助您自动执行此操作。
示例
以下标记示例包括 JSON-LD 格式的 QAPage
、Question
和 Answer
类型定义:
<html> <head> <title>How many ounces are there in a pound?</title> <script type="application/ld+json"> { "@context": "https://schema.org", "@type": "QAPage", "mainEntity": { "@type": "Question", "name": "How many ounces are there in a pound?", "text": "I have taken up a new interest in baking and keep running across directions in ounces and pounds. I have to translate between them and was wondering how many ounces are in a pound?", "answerCount": 3, "upvoteCount": 26, "datePublished": "2021-02-14T15:34-05:00", "author": { "@type": "Person", "name": "Mary Stone", "url": "https://example.com/profiles/mary-stone" }, "acceptedAnswer": { "@type": "Answer", "text": "1 pound (lb) is equal to 16 ounces (oz).", "image": "https://example.com/images/conversion-chart.jpg", "upvoteCount": 1337, "url": "https://example.com/question1#acceptedAnswer", "datePublished": "2021-02-14T16:34-05:00", "author": { "@type": "Person", "name": "Julius Fernandez", "url": "https://example.com/profiles/julius-fernandez" } }, "suggestedAnswer": [ { "@type": "Answer", "text": "Are you looking for ounces or fluid ounces? If you are looking for fluid ounces there are 15.34 fluid ounces in a pound of water.", "upvoteCount": 42, "url": "https://example.com/question1#suggestedAnswer1", "datePublished": "2021-02-14T15:39-05:00", "author": { "@type": "Person", "name": "Kara Weber", "url": "https://example.com/profiles/kara-weber" }, "comment": { "@type": "Comment", "text": "I'm looking for ounces, not fluid ounces.", "datePublished": "2021-02-14T15:40-05:00", "author": { "@type": "Person", "name": "Mary Stone", "url": "https://example.com/profiles/mary-stone" } } }, { "@type": "Answer", "text": " I can't remember exactly, but I think 18 ounces in a lb. You might want to double check that.", "upvoteCount": 0, "url": "https://example.com/question1#suggestedAnswer2", "datePublished": "2021-02-14T16:02-05:00", "author": { "@type": "Person", "name": "Joe Cobb", "url": "https://example.com/profiles/joe-cobb" } } ] } } </script> </head> <body> </body> </html>
<html> <body itemscope itemtype="https://schema.org/QAPage"> <div itemprop="mainEntity" itemscope itemtype="https://schema.org/Question"> <h2 itemprop="name">How many ounces are there in a pound?</h2> <div itemprop="upvoteCount">52</div> <div itemprop="text">I have taken up a new interest in baking and keep running across directions in ounces and pounds. I have to translate between them and was wondering how many ounces are in a pound?</div> <div> <div><span itemprop="answerCount">3</span> answers</div> <div><span itemprop="upvoteCount">26</span> votes</div> <div itemprop="acceptedAnswer" itemscope itemtype="https://schema.org/Answer"> <div itemprop="upvoteCount">1337</div> <div itemprop="text"> 1 pound (lb) is equal to 16 ounces (oz). </div> <a itemprop="url" href="https://example.com/question1#acceptedAnswer">Answer Link</a> </div> <div itemprop="suggestedAnswer" itemscope itemtype="https://schema.org/Answer"> <div itemprop="upvoteCount">42</div> <div itemprop="text"> Are you looking for ounces or fluid ounces? If you are looking for fluid ounces there are 15.34 fluid ounces in a pound of water. </div> <a itemprop="url" href="https://example.com/question1#suggestedAnswer1">Answer Link</a> </div> <div itemprop="suggestedAnswer" itemscope itemtype="https://schema.org/Answer"> <div itemprop="upvoteCount">0</div> <div itemprop="text"> I can't remember exactly, but I think 18 ounces in a lb. You might want to double check that. </div> <a itemprop="url" href="https://example.com/question1#suggestedAnswer2">Answer Link</a> </div> </div> </div> </body> </html>
指南
若要让 Google 对您的问答网页采用这种富媒体搜索结果处理方式,您必须遵循以下指南:
内容指南
- 仅当网页包含的信息采用问答格式(即先列出一个问题,后跟相应的答案)时,才能使用
QAPage
标记。 - 必须允许用户提交问题的答案。如果给定的问题只有 1 条答案,并且不支持用户提交备选答案,请不要对内容使用
QAPage
标记;在这种情况下应改用FAQPage
。以下是一些示例:有效用例:
- 一个论坛网页,用户可以在该网页上提交单个问题的答案
- 一个产品支持网页,用户可以在该网页上提交单个问题的答案
无效用例:
- 由网站本身编写的一个常见问题解答网页,用户无法在该网页上提交备选答案
- 一个产品页面,用户可以在这个页面上提交多个问题和答案
- 一份旨在回答问题的方法指南
- 一篇旨在回答问题的博文
- 一篇旨在回答问题的文章
- 如果并非所有内容都符合条件,请不要将
QAPage
标记应用于网站或论坛上的所有网页。例如,某个论坛可能发布了许多问题,并且这些问题分别都符合该标记的条件,不过,如果该论坛也有一些网页中的内容不是问题,那么这些网页就不符合条件。 - 不要对常见问题解答页或每页有多个问题的网页使用
QAPage
标记。QAPage
标记适用于重点论述单个问题以及相应答案的网页。 - 不要将
QAPage
标记用于广告目的。 - 确保每个
Question
包含完整的问题内容,并确保每个Answer
包含完整的答案内容。 Answer
标记适用于问题的答案,而不适用于对问题的评论或对其他答案的评论。请改为对此类内容使用comment
属性和Comment
类型。- 如果问题和答案包含以下任何类型的内容,那么它们可能不会显示为富媒体搜索结果:淫秽、亵渎、露骨色情、血腥暴力、宣传危险/违法活动,或仇恨性/骚扰性语言。
- 知识问答网页(这些网页侧重于为用户提交的家庭作业问题提供正确的答案)可能符合问答轮播界面体验的条件。这些网页可能只有由内部专家(而非用户)提供或选择的单个答案。
示例:一个教育网页,用户在该网页上提交了单个问题,专家选择了最佳答案。
结构化数据类型定义
本部分介绍了与 QAPage
相关的结构化数据类型。
要使您的内容能够显示为富媒体搜索结果,您必须为其添加必需的属性。您还可添加建议的属性,以便向结构化数据添加更多信息,进而提供更好的用户体验。
您可以使用 Google 的富媒体搜索结果测试工具验证和预览结构化数据。
QAPage
QAPage
类型表示网页重点论述了某个特定问题以及相应的答案。我们只会使用带有 QAPage
标记的网页中的 Question
结构化数据。每个网页只能有一个 QAPage
类型定义。
如需了解 QAPage
的完整定义,请访问 https://schema.org/QAPage。
下表介绍了 Google 搜索使用的 QAPage
类型的属性。
必需的属性 | |
---|---|
|
Question
相应网页的 |
Question
Question
类型定义了相应网页回答的问题,并且包含该问题的答案(如果有)。网页上应只有 1 个 Question
类型,并且它应嵌套在 schema.org/QAPage
的 mainEntity
属性下。每个网页必须只有 1 个 Question
类型定义。
如需了解 Question
的完整定义,请访问 https://schema.org/Question。 Google 支持的属性如下:
必需属性 | |||||
---|---|---|---|---|---|
|
Integer
对问题的回答总数。例如,如果有 15 条回答,但由于分页而仅标记了前 10 条,此值将为 15。对于没有答案的问题,此值也可能为 0。 |
||||
值为 acceptedAnswer 或 suggestedAnswer |
Answer
要显示为富媒体搜索结果,问题必须有至少 1 条答案 -
|
||||
|
Text
简短形式的问题的完整内容。例如,“一量杯是几茶匙的量?”。 |
建议的属性 | |
---|---|
|
Person 或 Organization
问题作者的相关信息。为了帮助 Google 更好地了解各种功能中的作者,建议您遵循作者标记最佳实践。 |
comment |
与问题相关的评论(如果存在)。理想情况下,此类内容不是答案,通常是关于问题的说明或讨论。 |
dateModified |
修改答案的日期和时间(如果适用),采用 ISO 8601 格式。 |
datePublished |
问题的发布日期和时间,采用 ISO 8601 格式。 |
image |
问题中的任何内嵌图片(如果适用)。 |
|
Text
详细问题的完整内容。例如,“我正在做饭,我需要知道杯子里放几茶匙的量。一量杯是几茶匙的量?” |
|
Integer
相应问题已得到的投票总数。如果网页支持顶和踩,则应将 |
video |
问题中的任何内嵌视频(如果适用)。 |
Answer
Answer
类型定义了相应网页上的 Question
的建议答案和被接纳的答案。您可以在 Question
中将 Answers
定义为 suggestedAnswer
和 acceptedAnswer
属性的值。
下表介绍了 Question
中使用的 Answer
类型的属性。
如需了解 Answer
的完整定义,请访问 https://schema.org/Answer。
必需的属性 | |
---|---|
|
Text
回答的完整内容。如果只标记了一部分,则可能不会显示您的内容,因为 Google 无法确定显示哪些内容最为恰当。 |
建议的属性 | |
---|---|
|
Person 或 Organization
答案作者的相关信息。为了帮助 Google 更好地了解各种功能中的作者,建议您遵循作者标记最佳实践。 |
comment |
与答案相关的评论,通常是关于答案的说明或讨论(如果适用)。 |
dateModified |
答案的修改日期和时间,采用 ISO 8601 格式(如果适用)。 |
datePublished |
问题的回答日期和时间,采用 ISO 8601 格式。 |
image |
问题中的任何内嵌图片(如果适用)。 |
|
Integer
相应答案已得到的投票总数(如果适用)。如果网页支持顶和踩,则应将 |
|
URL
直接链接到相应答案的网址。例如: |
video |
答案中的任何内嵌视频(如果适用)。 |
Comment
Comment
类型可视需要用于描述关于问题或答案的澄清性说明或讨论,既非问题也非答案。您可以在 Question
或 Answer
中将 Comments
定义为 comment
属性的值。
如需了解 Comment
的完整定义,请访问 https://schema.org/Comment。
必需属性 | |
---|---|
|
Text
评论的完整内容。如果只标记了一部分,Google 可能无法确定显示哪些文字最为恰当。 |
建议的属性 | |
---|---|
|
Person 或 Organization
评论作者的相关信息。为了帮助 Google 更好地了解各种功能中的作者,建议您遵循作者标记最佳实践。 |
comment |
用于回复评论的嵌套、消息串式评论(如果适用)。 |
dateModified |
评论的修改日期和时间,采用 ISO 8601 格式(如果适用)。 |
datePublished |
评论的撰写日期和时间,采用 ISO 8601 格式。 |
image |
评论中的任何内嵌图片(如果适用)。 |
video |
评论中的任何内嵌视频(如果适用)。 |
使用 Search Console 监控富媒体搜索结果
Search Console 是一款工具,可帮助您监控网页在 Google 搜索结果中的显示效果。即使没有注册 Search Console,您的网页也可能会显示在 Google 搜索结果中,但注册 Search Console 能够帮助您了解 Google 如何查看您的网站并做出相应的改进。建议您在以下情况下查看 Search Console:
首次部署结构化数据后
等 Google 将网页编入索引后,请在相关的富媒体搜索结果状态报告中查看是否存在问题。 理想情况下,有效项目数量会增加,而无效项目数量不会增加。如果您发现结构化数据存在问题,请执行以下操作:
发布新模板或更新代码后
如果对网站进行重大更改,请监控结构化数据无效项目的增幅。- 如果您发现无效项目增多了,可能是因为您推出的某个新模板无法正常工作,或者您的网站以一种新的错误方式与现有模板交互。
- 如果您发现有效项目减少了(但无效项目的增加情况并不对应),可能是因为您的网页中未再嵌入结构化数据。请通过网址检查工具了解导致此问题的原因。
定期分析流量时
请使用效果报告分析您的 Google 搜索流量。数据将显示您的网页在 Google 搜索结果中显示为富媒体搜索结果的频率、用户点击该网页的频率以及网页在搜索结果中的平均排名。您还可以使用 Search Console API 自动提取这些结果。Troubleshooting
If you're having trouble implementing or debugging structured data, here are some resources that may help you.
- If you're using a content management system (CMS) or someone else is taking care of your site, ask them to help you. Make sure to forward any Search Console message that details the issue to them.
- Google does not guarantee that features that consume structured data will show up in search results. For a list of common reasons why Google may not show your content in a rich result, see the General Structured Data Guidelines.
- You might have an error in your structured data. Check the list of structured data errors and the Unparsable structured data report.
- If you received a structured data manual action against your page, the structured data on the page will be ignored (although the page can still appear in Google Search results). To fix structured data issues, use the Manual Actions report.
- Review the guidelines again to identify if your content isn't compliant with the guidelines. The problem can be caused by either spammy content or spammy markup usage. However, the issue may not be a syntax issue, and so the Rich Results Test won't be able to identify these issues.
- Troubleshoot missing rich results / drop in total rich results.
- Allow time for re-crawling and re-indexing. Remember that it may take several days after publishing a page for Google to find and crawl it. For general questions about crawling and indexing, check the Google Search crawling and indexing FAQ.
- Post a question in the Google Search Central forum.