How to Use Multiple Itemprops in a Span Tag for Schema.Org Rich Snippets

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

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

Multiple Schema.org Product items & how will it look like in search engine result?

It’s perfectly fine to have multiple Product items on one page. This is even pretty common, for example for category or search pages listing several products.

What Google Search does or does not do with this markup may change at any point. Their documentation is at https://developers.google.com/structured-data/. It seems they currently don’t offer a Rich Snippet for product lists (their Product Rich Snippet is only for pages about a single product).

Can we have multiple itemprop's on single element for microdata tagging

My reading of the specification leads me to the conclusion that you can
have just one itemprop attribute per element but it can have more than
one value.

"Every HTML element may have an itemprop attribute specified... The
itemprop attribute, if specified, must have a value that is an
unordered set of unique space-separated tokens that are
case-sensitive, representing the names of the name-value pairs that it
adds. The attribute's value must have at least one token."
http://www.whatwg.org/specs/web-apps/current-work/multipage/microdata.html#names:-the-itemprop-attribute

You might try the nu validator or a microdata parser to test your code
and make sure you're getting the output you expect.

So instead of <span itemprop="name" itemprop="description"> you would use <span itemprop="name description">

Google's Rich Snippet Testing Tool may not be able to handle multiple itemprop values, yet, though.

I don't know what that asp will generate, but I think you want output more like this:
<a href="/" itemprop="url"><span itemprop="manufacturer">The Name</span></a>
In order to get access to the text content of the link you add an extra span. The value of an a element will always just be the value of its href attribute. Adding an extra span to get access to the text content of a link is a common pattern.

How do I reference a description from multiple Schema.org Events in Microdata?

The itemref attribute allows you to reference properties (itemprop), and it has to be specified on the item (itemscope) these properties should be added to.

So you have to

  • move itemref="event-summary" to the Event element, and
  • move itemprop="description" to the element with the description.
<div itemscope itemtype="http://schema.org/Event" itemref="event-summary">
</div>

<div itemprop="description" id="event-summary">
</div>

You would ideally do this for the location, too, because having a meta element without a content attribute is invalid (but this could be fixed by adding an empty attribute), and because you could save one element that way.

<div itemscope itemtype="http://schema.org/Event" itemref="venue-place event-summary">
</div>

<div itemprop="location" itemscope itemtype="http://schema.org/Place" id="venue-place">
</div>

<div itemprop="description" id="event-summary">
</div>

(Note that Google’s Structured Data Testing Tool will use the id value of the Place element to display URIs under @id. I think that’s a bug on their end, so don’t let this confuse you. If you want to get rid of it, you could add an itemid attribute in addition to provide a real/actual URI for the place.)

Splitting schema.org Microdata over multiple divs or elements

No, a parser will probably see what you're suggesting as 3 separate Local Business entities.

But you can have other text between the various properties in http://schema.org/LocalBusiness as follows:

<div itemscope itemtype="http://schema.org/LocalBusiness">
<a itemprop="url" href="url"><div itemprop="name"><strong>name</strong></div></a>
<p>
This paragraph is not used by schema.org
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam blandit pretium
massa, in consectetur velit. Vivamus aliquam, turpis in pellentesque pulvinar,
lectus diam fermentum velit, quis fermentum arcu turpis in orci. Duis egestas
urna vel velit suscipit mollis. Nulla sed diam massa.
</p>
<div itemprop="description">My Description</div>
</div>


Related Topics



Leave a reply



Submit