简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM