Does JSON-LD have to be embedded?

混江龙づ霸主 提交于 2019-11-27 12:07:53
unor

If you are using the script element as data block, "the src attribute must not be specified".

If the script element is not used as data block, it has to be "used to include dynamic scripts". But a JSON-LD document is not a dynamic script.

For linking to another resource, just like you do it with external stylesheets or Favicons, you can use the link element in the head (or the corresponding HTTP header):

<link href="/myid123/jsonld.js" rel="alternate" type="application/ld+json" />

In principle, consumers could follow this reference (possibly only if a certain link type is specified), and make use of data, just like they do it with embedded JSON-LD, Microdata, or RDFa.

However, consumers don’t have to do this, of course, and many probably don’t.
Google Search in particular does not claim to support it for consuming Schema.org in the JSON-LD format. However, they claim to support "dynamically injected" JSON-LD data blocks.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!