Html 混合JSON-LD和MicrodataSchema.org
如果我有以下标记:Html 混合JSON-LD和MicrodataSchema.org,html,schema.org,microdata,json-ld,Html,Schema.org,Microdata,Json Ld,如果我有以下标记: <body itemscope="" itemtype="http://schema.org/WebPage"> <h1 itemprop="name">Lecture 12: Graphs, networks, incidence matrices</h1> <p itemprop="description">These video lectures of Professor Gilbert Strang te
<body itemscope="" itemtype="http://schema.org/WebPage">
<h1 itemprop="name">Lecture 12: Graphs, networks, incidence matrices</h1>
<p itemprop="description">These video lectures of Professor Gilbert
Strang teaching 18.06 were recorded in Fall 1999 and do not
correspond precisely to the current edition of the textbook.</p>
<div itemprop="publisher" itemscope="" itemtype="http://schema.org/CollegeOrUniversity">
<h4 class="footer">About <span itemprop="name">MIT OpenCourseWare</span></h4>
</div>
<a itemprop="license"
rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/us/deed.en_US"><img
src="/images/cc_by-nc-sa.png" alt="Creative Commons logo with terms BY-NC-SA." /></a>
</body>
第12课:图、网络、关联矩阵
吉尔伯特教授的这些视频讲座
Strang教学18.06记录于1999年秋季,未记录
与当前版本的教科书完全一致
关于麻省理工学院开放式课程
我想重构publisher属性,因为它很复杂,我不想显示它并执行以下操作:
<body itemscope="" itemtype="http://schema.org/WebPage">
<h1 itemprop="name">Lecture 12: Graphs, networks, incidence matrices</h1>
<p itemprop="description">These video lectures of Professor Gilbert
Strang teaching 18.06 were recorded in Fall 1999 and do not
correspond precisely to the current edition of the textbook.</p>
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "CollegeOrUniversity",
"name": "MIT OpenCourseWare"
}
</script>
<a itemprop="license"
rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/us/deed.en_US"><img
src="/images/cc_by-nc-sa.png" alt="Creative Commons logo with terms BY-NC-SA." /></a>
</body>
第12课:图、网络、关联矩阵
吉尔伯特教授的这些视频讲座
Strang教学18.06记录于1999年秋季,未记录
与当前版本的教科书完全一致
{
“@context”:”http://schema.org",
“@type”:“大学”,
“名称”:“麻省理工学院开放式课程”
}
如何说
块与itemprop=“publisher”
属性相关
我想这两个选择是(我)。将itemprop
属性添加到脚本标记或ii)。在JSON-LD块中添加一个@属性来代替itemprop
我找不到关于这两个方面的文档。有人知道答案吗?在纯JSON-LD中,这种关系可以通过嵌套属性来表示,如下所示:
<body>
<h1>Lecture 12: Graphs, networks, incidence matrices</h1>
<p>These video lectures of Professor Gilbert
Strang teaching 18.06 were recorded in Fall 1999 and do not
correspond precisely to the current edition of the textbook.</p>
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type" : "WebPage",
"name" : "Web page name",
"description" : "Web page desc",
"license" : "http://creativecommons.org/licenses/by-nc-sa/3.0/us/deed.en_US",
"publisher" : {
"@context": "http://schema.org",
"@type": "CollegeOrUniversity",
"name": "MIT OpenCourseWare"
}
}
</script>
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/us/deed.en_US"><img
src="/images/cc_by-nc-sa.png" alt="Creative Commons logo with terms BY-NC-SA." /></a>
</body>
第12课:图、网络、关联矩阵
这些是吉尔伯特教授的视频讲座
Strang教学18.06记录于1999年秋季,未记录
与当前版本的教科书完全一致
{
“@context”:”http://schema.org",
“@type”:“网页”,
“名称”:“网页名称”,
“说明”:“网页说明”,
“许可证”:http://creativecommons.org/licenses/by-nc-sa/3.0/us/deed.en_US",
“出版商”:{
“@context”:”http://schema.org",
“@type”:“大学”,
“名称”:“麻省理工学院开放式课程”
}
}
但如果您将网页作为微数据保存在HTML中,那么在中进行测试时,您将得到两个网页实例
我认为最好只在一个页面上使用微数据或JSON-LD。这是不可能的。如果在script
元素上使用itemprop
属性,则script
的。这本质上类似于itemprop=“{@context”:http://schema.org“,“@type”:“CollegeOrUniversity”,“name”:“MIT OpenCourse”}”
,因此该值是纯文本,而不是JSON-LD(并且不解释为JSON-LD)
如果您不想让发布者名称在页面上可见,可以使用meta
元素:
也可以对JSON-LD节点使用a并在微数据中引用此URI,但有些使用者可能不支持它(有些使用者可能根本不遵循引用,有些使用者可能只识别Schema.org对属性的期望:组织
/个人
,而不是URL):
{
“@context”:”http://schema.org",
“@type”:“大学”,
“@id”:”http://example.com/mit-opencourseware#thing",
“名称”:“麻省理工学院开放式课程”
}
线性数据的全部意义在于,任何人都可以在任何地方说任何话。在这种情况下,您可以在微数据中使用@itemid来标识资源URI,并使用与JSON-LD中@id的值(显式或隐式)相同的URI。这当然是结构化数据Linter对它的解释。你需要试试谷歌的结构化数据测试工具,看看他们是如何解释的
如果您想在Microdata和JSON-LD(或RDFa)中引用相同的资源,这是您唯一的机制@脚本元素上的itemrel不起任何作用 这个@parent
来自哪里?在@unor中似乎没有提到它,我创建了@parent
属性作为示例。我将编辑问题以澄清这一点。很抱歉浪费您的时间在规范中查找它。@unor我认为使用
是一种方法。如果没有其他解决办法,我会接受你的回答。我的问题是,我的网站上有很多组织
和人员
(人员),我想优化对Schema.org块的重用。仅供参考,我正在使用Jekyll和“数据文件”。我想我可以用普通的HTML块包含来代替。与这个问题相关的是:“你可以在同一个页面上使用不同的格式,或者甚至在你的桌面和移动站点之间混合使用不同的格式吗?谷歌说这不应该是个问题,假设两端的实际输出是相同的。”