【发布时间】:2019-08-12 13:18:43
【问题描述】:
我将 JSON-LD 异步部署到脚本标签中:
var jsonLD = document.createElement('script');
jsonLD.type = 'application/ld+json';
jsonLD.innerHTML = JSON.stringify({
"@context": "https://json-ld.org/contexts/person.jsonld",
"@id": "http://dbpedia.org/resource/John_Lennon",
"name": "John Lennon",
"born": "1940-10-09",
"spouse": "http://dbpedia.org/resource/Cynthia_Lennon"
});
document.head.appendChild(jsonLD);
Google's testing tool 在检查 URL 时无法识别任何 JSON-LD。它是否仍会被索引,或者 Google(和其他机器人)是否对异步加载的 JSON-LD 视而不见?
【问题讨论】:
-
你指的是什么google测试工具?通常没有索引机器人会在他们抓取的网站上执行任何 javascript - 这将包括您在上面使用的脚本
标签: javascript json-ld google-rich-snippets