schema.org - PageMap 不包含在 Google 自定义搜索引擎的搜索结果中
问题描述
我有一个自定义搜索引擎和我自己的 React 客户端,它使用 CSE json API 呈现搜索结果。我想使用结构化数据显示丰富的结果,所以我在我的源 HTML 文件中添加了一个 PageMap。但是来自 Google 的搜索结果不包含 PageMap 中的任何数据。
结构化数据通常用于过滤搜索结果。我在这里关心的是在自定义搜索结果中接收结构化数据的简单问题,因此我可以自己呈现它。
这是来自我的 CSE 中的一个站点的示例源 HTML 页面:
查看源代码: http: //www.johndimm.com/eleventh-hour/papyritec/Humidity_control_tile.html
它在标题中有一个 PageMap(还有使用 schema.org 的产品的 ld+json):
<!--
<PageMap>
<DataObject type="document">
<Attribute name="product_name">Humidity control tile</Attribute>
<Attribute name="rating">4.0</Attribute>
<Attribute name="description">With the integration of nanotechnology into the humble ceramic tile, we have a new generation of tiles to solve household problems. Our nanotech tiles can regulate humidity by absorbing excess moisture and storing it in the tiny pores; and by releasing moisture when the environment is dry. It also absorbs VOCs and air pollutants into the pores and catalyse reactions to break down toxicity in those gases. Due to its porosity, it is a fantastic insulator of both heat and sound. Think nano-tiles for your next renovation!</Attribute>
<Attribute name="product_id">nanotile01</Attribute>
</DataObject>
<DataObject type="thumbnail">
<Attribute name="src" value="nanotile01.jpg" />
<Attribute name="width" value="300" />
</DataObject>
</PageMap>
-->
搜索结果不显示这些信息,尽管有一个 pagemap 对象:
https://www.googleapis.com/customsearch/v1?key=[cse key]&cx=010143774142193520043:z76tkkewcr9&q=papyritec%20湿度
页面地图只有 cse_thumbnail 和 cse_image,我认为是由 Google 添加的。
"pagemap": {
"cse_thumbnail": [
{
"src": "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcRtbYjjezl1LjCPxzWlcqP8qqUwOZ31ap1fvMz9w5tq1YYY8_pSL4ITR6E",
"width": "203",
"height": "249"
}
],
"cse_image": [
{
"src": "http://www.johndimm.com/eleventh-hour/papyritec/images/nanotile01.jpg"
}
]
}
问题:我做错了什么?这是包含 PageMap 的正确方法吗?我的页面地图字段是否应该已合并到每个结果项中的页面地图对象中?
更多细节:
此页面的结构化数据测试工具找到了 ld+json,但没有找到 PageMap:
富结果测试还显示 ld+json 数据,但不显示 PageMap。
这是一篇显示搜索结果中出现的自定义页面地图的帖子。这是我希望看到的。它只是付费级别的功能吗?
谷歌的这篇文章说“请注意,目前 CSE 不支持 JSON-LD。”
https://support.google.com/customsearch/thread/12070581?hl=en
PageMap 似乎是结构化数据的首选方法。必须有某种方法使它起作用。
解决方案
我不够耐心。18 个 html 文件之一现在与我的大部分页面地图数据一起显示在搜索结果中。它们都具有相同的格式,所以也许我只需要等待更多时间让 Google 以相同的方式处理它们。
由于某种原因,其中一个字段仍然缺失。文档对象具有描述、评级和产品名称,但没有产品 ID。
但这回答了我的问题。此处描述的设置确实有效,并且传递的自定义页面地图数据或多或少是搜索结果。
"pagemap": {
"thumbnail": [
{
"src": "Oryzasil.png",
"width": "300"
}
],
"document": [
{
"rating": "4.0",
"description": "Silicon based aerogel blanket. Super low thermal conductivity: 0.020 W/mK at 10mm. Comes in different thickness of 3mm, 5mm, and 10mm. Contact us for a product recommendation. Used predominantly in oil and gas industries.",
"product_name": "Silicon hydrophobic aerogel"
}
],
"metatags": [
{
"viewport": "width=device-width, initial-scale=1.0, maximum-scale=1.0, \n user-scalable=no"
}
],
"cse_image": [
{
"src": "http://www.johndimm.com/eleventh-hour/papyritec/images/Oryzasil.png",
"width": "247",
"type": "1",
"height": "204"
}
]
}
推荐阅读
- sql - 有没有办法确保 WHERE 子句在 DISTINCT 之后发生?
- c++ - rdtsc乱序执行的解决方案?
- java - 数字日期格式
- angular - 当使用异步管道在 NGXS 存储中更改状态时,Angular 组件不会重新评估
- sql - 过滤视图时如何利用基础索引?
- c# - 我需要使用 xpath 在我的 HTML 中获取没有标签的文本
- javascript - 当我尝试在我的网站上构建键盘快捷键时,为什么 jQuery keyup 不起作用?
- karate - 如果一个 json 包含另一个带有空手道的 json,则匹配
- pine-script - 寻找一个代码,找到两种颜色中的所有颜色,并将它们应用到一个范围内的脚本中
- java - 定义了一个 Int 但需要一个数组?