【发布时间】:2016-05-23 01:00:33
【问题描述】:
无论如何使用 JSON-LD 而不在 HTML 中包含 script 内联,但仍然让谷歌(和其他)蜘蛛找到它?环顾四周,我看到了一些相互矛盾的信息。
如果这是 JSON-LD 文件:
<script type="application/ld+json">
{
"@context" : "http://schema.org",
"@type" : "WebSite",
"name" : "Example Site",
"alternateName" : "example",
"description" : "Welcome to this WebSite",
"headline" : "Welcome to Website",
"logo" : "https://example.com/public/images/logo.png",
"url" : "https://example.com/"
}
</script>
我在 HTML 的 head 中有这个:
<script src="/public/json-ld.json" type="application/ld+json"></script>
编辑:我也试过:
<link href="/public/json-ld.json" rel="alternate" type="application/ld+" />
Google Spiders 似乎错过了它,测试工具也是如此,除非我将它直接指向文件。我正在尝试解决 CSP 中的 unsafe-inline 问题。还有only thing I can find is this,它可以在 Chrome 中工作,但不想在其他所有浏览器上触发控制台错误。另外,我只是喜欢将 Schema.org 数据从页面结构中抽象出来的想法。将 JSON-LD 添加到 Google 网站管理员工具的站点地图会有帮助吗?
抱歉,对 JSON-lD 完全陌生,并且不断出现在电子邮件文档(这将是针对网站)或旧文档中。
【问题讨论】:
-
这个试过了,还是没上手。我的最佳猜测是外部文件尚不支持网站的 JSON-LD。
标签: seo schema.org content-security-policy json-ld