问答 (QAPage
) 结构化数据
![一个问题和答案富媒体搜索结果图示](https://developers.google.cn/static/search/docs/images/qa-rich-result.png?authuser=6&hl=sr)
问答网页是包含问答格式数据(先列出一个问题,后跟相应的答案)的网页。对于表示问题及相应答案的内容,您可以使用 schema.org QAPage
、Question
和 Answer
类型标记数据。
如果您正确标记了网页,Google 就会在搜索结果页上为其显示富媒体搜索结果。这种富媒体搜索结果处理方式有助于您的网站通过 Google 搜索覆盖合适的用户。 例如,如果用户查询“如何取出卡在 USB 端口中的数据线?”,而提供此问题答案的网页已加上标记,就可能会显示该查询的富媒体搜索结果。
除了能够使系统对您的内容采用富媒体搜索结果处理方式之外,标记问答网页还有助于 Google 为该网页生成更好的摘要。如果未显示富媒体搜索结果,那么答案的内容可能会出现在基本搜索结果中。
How to add structured data
Structured data is a standardized format for providing information about a page and classifying the page content. If you're new to structured data, you can learn more about how structured data works.
Here's an overview of how to build, test, and release structured data.
- Add the required properties. Based on the format you're using, learn where to insert structured data on the page.
- Follow the guidelines.
- Validate your code using the Rich Results Test and fix any critical errors. Consider also fixing any non-critical issues that may be flagged in the tool, as they can help improve the quality of your structured data (however, this isn't necessary to be eligible for rich results).
- Deploy a few pages that include your structured data and use the URL Inspection tool to test how Google sees the page. Be sure that your page is
accessible to Google and not blocked by a robots.txt file, the
noindex
tag, or login requirements. If the page looks okay, you can ask Google to recrawl your URLs. - To keep Google informed of future changes, we recommend that you submit a sitemap. You can automate this with the 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": "2024-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": "2024-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": "2024-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": "2024-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": "2024-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 |
评论中的任何内嵌视频(如果适用)。 |
Monitor rich results with Search Console
Search Console is a tool that helps you monitor how your pages perform in Google Search. You don't have to sign up for Search Console to be included in Google Search results, but it can help you understand and improve how Google sees your site. We recommend checking Search Console in the following cases:
- After deploying structured data for the first time
- After releasing new templates or updating your code
- Analyzing traffic periodically
After deploying structured data for the first time
After Google has indexed your pages, look for issues using the relevant Rich result status report. Ideally, there will be an increase of valid items, and no increase in invalid items. If you find issues in your structured data:
- Fix the invalid items.
- Inspect a live URL to check if the issue persists.
- Request validation using the status report.
After releasing new templates or updating your code
When you make significant changes to your website, monitor for increases in structured data invalid items.- If you see an increase in invalid items, perhaps you rolled out a new template that doesn't work, or your site interacts with the existing template in a new and bad way.
- If you see a decrease in valid items (not matched by an increase in invalid items), perhaps you are no longer embedding structured data in your pages. Use the URL Inspection tool to learn what is causing the issue.
Analyzing traffic periodically
Analyze your Google Search traffic using the Performance Report. The data will show you how often your page appears as a rich result in Search, how often users click on it and what is the average position you appear on search results. You can also automatically pull these results with the 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.