【发布时间】:2016-03-07 13:02:41
【问题描述】:
如果我有以下标记:
<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>
我想重构 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>
我怎么说<script> 块与itemprop="publisher" 属性相关?
我猜这两个选项是 i)。将itemprop 属性添加到脚本标签或 ii)。在 JSON-LD 块中添加 @attribute 代替 itemprop。
我找不到任何文档。有人知道答案吗?
【问题讨论】:
-
这个
@parent来自哪里? JSON-LD spec里好像没有提到。 -
@unor 我以
@parent属性为例。我将编辑问题以澄清这一点。很抱歉浪费您的时间在规范中查找。 -
@unor 我认为使用
<meta>是可行的方法。如果没有其他解决方案即将出现,我会接受您的回答。我的问题是我的网站上有很多Organizations 和Person(人物),我想优化重用他们的 Schema.org 块。仅供参考,我正在使用 Jekyll 和“数据文件”。我想我可以改用普通的 HTML 块包含。 -
与此问题相关:“您是否允许在同一页面上使用不同的格式,甚至可以在您的桌面和移动网站之间混合使用它们?谷歌表示这应该不是问题,假设两端的实际输出相同。” seroundtable.com/google-formats-schema-22999.html
标签: html schema.org microdata json-ld