我们可以有多个itemprop的单个元素对微观数据标记 [英] Can we have multiple itemprop's on single element for microdata tagging

查看:266
本文介绍了我们可以有多个itemprop的单个元素对微观数据标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们能标记有多个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 can have just one itemprop attribute per element but it can have more than one value.

每一个HTML元素可以指定一个itemprop属性...的 itemprop属性,如果指定,必须有一个值,该值是 无序一套独特的空间分隔的标记是 区分大小写,再presenting的名称 - 值对的名称,它 补充道。属性的值必须至少有一个标记。 <一href="http://www.whatwg.org/specs/web-apps/current-work/multipage/microdata.html#names:-the-itemprop-attribute">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... 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

您可以尝试怒江验证或微观数据分析程序来测试你的code 并确保你得到你所期望的输出。

You might try the nu validator or a microdata parser to test your code and 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的单个元素对微观数据标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆