结构化数据标签的生成无法通过GoogleBot在Angular Spa应用程序上查看
在Google搜索控制台上实时测试URL时,GoogleBot可以呈现页面,但我的结构化数据丢失了。它是在JS中生成的:
insertStructuredData(genDataFn: Function): void {
this.removeStructuredDataElement();
let script = this.getStructuredDataElement();
if (!script) {
script = document.createElement('script');
script.type = 'application/ld+json';
script.id = STRUCTURED_DATA_TAG_ID;
document.head.appendChild(script);
}
safeScriptEl.setTextContent(script, scriptFromJson(genDataFn()));
}
当我自己查看页面时,它显示得很好:
<script type="application/ld+json" id="structuredDataScriptTagId" nonce="abcdefg">...</script>
但是,当我查看GoogleBot在实时测试中看到的HTML时,该标签在页面中缺少。这纯粹是一个延迟问题,还是有其他影响该标签对Googlebot的可见性的东西?
When live testing a URL on Google Search Console, Googlebot can render a page but my structured data is missing. It is generated in JS via:
insertStructuredData(genDataFn: Function): void {
this.removeStructuredDataElement();
let script = this.getStructuredDataElement();
if (!script) {
script = document.createElement('script');
script.type = 'application/ld+json';
script.id = STRUCTURED_DATA_TAG_ID;
document.head.appendChild(script);
}
safeScriptEl.setTextContent(script, scriptFromJson(genDataFn()));
}
When I view the page myself it shows up just fine:
<script type="application/ld+json" id="structuredDataScriptTagId" nonce="abcdefg">...</script>
But when I view the HTML that Googlebot see on the Live test, this tag is missing from the page. Is this purely a latency issue or could there be anything else impacting this tag's visibility to Googlebot?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以检查一些事情:
基本上,您可以做到,但是即使到那时,Google仍会决定是否使用结构化数据对象上定义的数据;正如他们在官方文档中所说的那样搜索结果中的实际外观可能不同
There are a few things that you can check:
That's basically al you can do, but even then, Google will decide whether to use or not the data defined on your structured-data objects; as they have stated on the official documentation The actual appearance in search results might be different