如何实现JSON-LD? [英] How to implement JSON-LD?
问题描述
我今天一直在阅读关于JSON-LD的内容,并且我理解它的目的,格式,并且我可以将它放在脚本标记中;然而,我不明白以下内容:
-
这个数据在哪里可以驻留,而不是在网站的脚本标记中?我一直在期待在任何脚本标记或包含.json文件中查找JSON-LD内容,当我查看说他们使用JSON-LD的网站的页面源时,但由于我没有看到任何这些内容,它导致我相信它必须可以在不同的位置访问。
$ -
这些信息通常是为大型网站构建的吗? b $ b
-
其他网站如何找到JSON-LD文件,对象或数据来使用该信息?
b $ b Where can this data reside other than in a script tag for a website? I've been expecting to find JSON-LD content in either script tags or included .json files when I view the page source of websites that say they use JSON-LD, but since I haven't seen any of this, it leads me to believe it must be accessible in a different location.
How is this collection of information usually constructed for larger websites?
How do other sites find the JSON-LD files, objects, or data to use that information?
在野外看到一个例子真是太棒了。
在HTML5中, href =http://www.w3.org/TR/2014/REC-html5-20141028/scripting-1.html#the-script-element =nofollow noreferrer> script
元素可以用作数据块:
当用于包含数据块时脚本),数据必须嵌入内嵌,数据的格式必须使用
类型
属性中,不得指定src
属性,并且脚本
元素的内容必须符合定义的要求对于使用的格式。
因此,包含JSON-LD的脚本
元素可以看起来像这样:
$ b
< script type =application / ld + json>
{
@context:http://example.com,
@type:示例
}
< / script>
I’ve been reading about JSON-LD today and I understand its purpose, format, and that I can put it in a script tag; however, I don’t understand the following:
It would be really great to see an example in the wild.
In HTML5, the script
element can be used as data block:
When used to include data blocks (as opposed to scripts), the data must be embedded inline, the format of the data must be given using the
type
attribute, thesrc
attribute must not be specified, and the contents of thescript
element must conform to the requirements defined for the format used.
So a script
element containing JSON-LD could look like this:
<script type="application/ld+json">
{
"@context": "http://example.com",
"@type": "Example"
}
</script>
You may place the script
element(s) in the head
and/or in the body
.
这篇关于如何实现JSON-LD?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!