从每个子页面中删除结构错误的数据——仅在主页添加“站点链接搜索框”

TL;DR:目前,我们正在为每一个页面、子页面、主题等告知 Google 该页面本身具有 \"url\":\"https://www.example.com/\"
– 对于 URL 类似于 https://meta.discourse.org/t/add-sitelinks-search-box-to-the-homepage-only/219299 的主题页面来说,这绝对是错误的。


Sitelinks Search Box 的代码目前已在每个页面、类别和主题上实现:

<script type="application/ld+json">
{
  "@context":"http://schema.org",
  "@type":"WebSite",
  "url":"https://www.example.com/",
  "potentialAction":{
    "@type":"SearchAction",
    "target":"https://www.example.com/search?q={search_term_string}",
    "query-input":"required name=search_term_string"
  }
}
</script>

例如,请参阅 Google Search Console 报告“增强功能”->“Sitelinks 搜索框

根据 Google 的说法,它应该只添加到主页:


2 个赞

关于 Googles 的更多背景信息:“将 [搜索摘要的 application/ld+json 数据] 标记添加到主页,不要添加到任何其他页面。”

\u003cscript type='application/ld+json'\u003e 会向 Google 提供有关其定义的实际页面/网址内容的信息。

目前,我们告诉 Google 每个页面、子页面、主题等,该页面本身是:

  • \"@type\":\"WebSite\"
  • \"url\":\"https://www.example.com/\"
    – 对于网址为 https://meta.discourse.org/t/add-sitelinks-search-box-to-the-homepage-only/219299 的主题页面来说,这绝对是错误的。

我们应该从除主页以外的所有页面中删除 application/ld+json data
或者,我们应该为每个子页面声明代表该页面内容的正确的、特定于页面的 application/ld+json data

关于如何为 List 页面(例如“轮播”)正确使用 application/ld+json data 的示例

3 个赞

是的,此功能仅属于主页和类别/标签页,欢迎提交 PR 改进。

2 个赞

此 PR DEV: output sitelinks search tag on homepage only by rr-it · Pull Request #16157 · discourse/discourse · GitHub 移除了除主页外的所有页面的结构化数据。主页是选定的主页:例如,主页、分类概览、主题列表……

我的假设是,分类和标签页面不需要此结构化数据。

1 个赞

嘿,感谢你提交的优秀 PR——它现在已经被合并了。

2 个赞