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

后端 未结 2 2101
故里飘歌
故里飘歌 2020-11-29 08:21

Let\'s say I have the following sentence I want to add rich snippets to:

I live and work in New York

Since New York is both my r

相关标签:
2条回答
  • 2020-11-29 08:36

    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

    0 讨论(0)
  • 2020-11-29 08:51

    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].)

    0 讨论(0)
提交回复
热议问题