问题描述
我们能标记有多个itemprop属性一个HTML元素?我工作的东西微观数据标记。(schema.org)
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>
超链接文本包含的属性我想标记这可能按schema.org标准?
The hyperlink Text contains both properties I want to tag Is this possible as per schema.org standards?
在此先感谢。
推荐答案
我该规范的阅读使我的结论是,你可以只有一个每个元素itemprop属性,但它可以有多个一个值。
My reading of the specification leads me to the conclusion that you canhave just one itemprop attribute per element but it can have more thanone value.
每一个HTML元素可以指定一个itemprop属性...的itemprop属性,如果指定,必须有一个值,该值是无序一套独特的空间分隔的标记是区分大小写,再presenting的名称 - 值对的名称,它补充道。属性的值必须至少有一个标记。http://www.whatwg.org/specs/web-apps/current-work/multipage/microdata.html#names:-the-itemprop-attribute
"Every HTML element may have an itemprop attribute specified... Theitemprop attribute, if specified, must have a value that is anunordered set of unique space-separated tokens that arecase-sensitive, representing the names of the name-value pairs that itadds. 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
您可以尝试怒江验证或微观数据分析程序来测试你的code并确保你得到你所期望的输出。
You might try the nu validator or a microdata parser to test your codeand make sure you're getting the output you expect.
因此,而不是&LT;跨度itemprop =名称itemprop =描述&GT;
您可以使用&LT;跨度itemprop =名称描述&GT;
So instead of <span itemprop="name" itemprop="description">
you would use <span itemprop="name description">
谷歌的丰富网页摘要测试工具可能无法处理多个itemprop值,然而,虽然。
Google's Rich Snippet Testing Tool may not be able to handle multiple itemprop values, yet, though.
我不知道那是什么的ASP将产生,但我认为你要输出更多的是这样的:&LT; A HREF =/itemprop =URL&GT;&LT;跨度itemprop =制造商&gt;该名称与LT; / SPAN&GT;&LT; / A&GT;
为了获得访问该链接的文本内容,您添加一个额外的跨度。一个一个元素的值将永远只是它的href属性的值。添加一个额外的跨度可以访问一个链接的文本内容是一个常见的模式。
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.
这篇关于我们可以有多个itemprop的单个元素对微观数据标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!