Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Can we tag a single html element with multiple "itemprop" properties? I'm working on something for micro data tagging.(schema.org)

<asp:HyperLink ID="hlnk10" itemprop="url" itemprop ="manufacturer"  runat="server">     </asp:HyperLink>

The hyperlink Text contains both properties I want to tag Is this possible as per schema.org standards?

Thanks in advance.

like image 597
karry Avatar asked Feb 28 '12 16:02

karry


People also ask

What is the benefit of using meta Itemprops in HTML?

The itemprop global attribute is used to add properties to an item. Every HTML element can have an itemprop attribute specified, and an itemprop consists of a name-value pair. Each name-value pair is called a property, and a group of one or more properties forms an item.

What is microdata markup?

Microdata is a specification to embed machine-readable data in HTML documents. Microdata consists of name-value pairs (known as items ) defined according to a vocabulary. A collection of commonly used markup vocabularies are provided by schema.org.

What is microdata in html5 and how is it created?

Microdata is an attempt to provide a simpler way of annotating HTML elements with machine-readable tags than the similar approaches of using RDFa and classic microformats. At a high level, microdata consists of a group of name-value pairs. The groups are called items, and each name-value pair is a property.

What is microdata schema?

Schema.org (often called schema) is a semantic vocabulary of tags (or microdata) that you can add to your HTML to improve the way search engines read and represent your page in SERPs.


1 Answers

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.

like image 158
Jason R Avatar answered Sep 22 '22 16:09

Jason R