Can I Use Multiple ItemProps in a Span Tag for schema.org Rich Snippets?

拜拜、爱过 提交于 2019-11-27 01:48:39
unor

The usual HTML way would be to use one attribute and separate several values with space characters.

Looking into the Microdata specification, you’ll notice that this is the case for the itemprop attribute, too:

The itemprop attribute, if specified, must have a value that is an unordered set of unique space-separated tokens […]

So this should be correct:

<div itemscope itemtype="http://schema.org/Person">
  I live and work in <span itemprop="homeLocation workLocation">New York</span>
</div>

(Note: If using itemprop values as CSS selector, use [att~=val] instead of [att=val].)

The first snippet of code I posted does not work, but the second does. Google has a rich snippets page tester which is pretty useful for code validation

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