使用 Microdata 从语义上声明 itemtype=".../Person"
的 itemprop="image"
的旧方法如下:
<section itemscope itemtype="http://data-vocabulary.org/Person">
<h1 itemprop="name">Andy Runie</h1>
<p>
<img itemprop="photo" src="http://www.example.com/photo.jpg">
</p>
</section>
很简单。
显然(根据 the documentation )以前的方法已被弃用,HTML5 微数据中使用的"new"模式是 Schema.org 。
Schema.org文档显示“Thing”是“Person”的父级
和
itemprop="image"
现在位于“Thing”下。而之前 itemprop="photo"
位于“Person”下。
根据 documentation (2a.schema.org类型和属性)我们发现Person继承自Thing...
问题:
使用这个新标准,我可以简单地使用以下内容在 HTML 中正确显示“is
itemtype="http://schema.org/Person"`吗?
<section itemscope itemtype="http://schema.org/Person">
<h1 itemprop="name">Andy Runie</h1>
<p>
<img itemprop="image" src="http://www.example.com/photo.jpg">
</p>
</section>
最佳答案
是的,你是对的。
如果您导航至 http://schema.org/Person您可以使用所有提到的属性来描述一个人,其中包括 Thing 中的所有属性如图像、名称、描述和网址。
关于HTML5 Microdata/Schema.org "Thing>Person"实现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16572414/