什么是 RDFa +微数据/微格式以及为什么我需要它们?
我偶然发现了 RDFa,并且看到了经常使用的术语微数据和微格式。
它们是什么以及为什么它们在开发网站时有用?
I have stumbled upon RDFa and have seen the terms microdata and microformats used frequently.
What are they and why might they be useful when developing websites?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
语义学。如今,主要原因是谷歌可以显示丰富的摘要。要了解其工作原理,请将您的网页放入 http://www.google.com/webmasters/tools /richsnippets 并看看它会拾取什么。尝试该页面上的示例,看看它们在搜索结果中使用的内容。
Google 还有一个名为 http://schema.org/ 的页面,概述了用于标记事物的微数据架构。
在我看来,微数据是正确的选择,微格式重载了类属性,尽管我理解它在规范之内,但对我来说,它不再是放置此信息的最佳位置。 RDFa 确实很好,但它很复杂,而且对大多数人来说并不那么明显。微数据是清晰的、定义良好的并且得到谷歌的支持,因此我建议使用它。
在我的网站上,我已经用微数据完全取代了微格式,尽管我是整个微格式系统的超级早期采用者和追随者。
Semantics. Nowadays, the main reason is so Google can show Rich Snippets. To see how this works, put your page into http://www.google.com/webmasters/tools/richsnippets and see what it picks up. Try the examples on that page to see what they are using in search results.
Google also have a page called http://schema.org/ that outlines their microdata schema for marking things up.
In my opinion microdata is the way to go, microformats overloaded the class attribute, and though I understand it's within the spec, for me it's no longer the best place to put this info. RDFa is really good, but it's complex and not that obvious to most. Microdata is clear, well defined and backed by Google, hence my recommendation to use that.
On my sites, I've completely replace microformats with microdata, despite being a super early adopter and follower of the whole microformat system.
它们有助于让搜索引擎和用户直接了解网站内容,而无需猜测。
使用 RDFa,用户可以像往常一样直接看到网页,而搜索引擎可以看到网站上重要术语周围的隐形跨度及其定义。
搜索引擎目前选择的最突出的例子是 Yahoo 的 SearchMonkey 选择一些主要社区定义的架构,并由 Google 控制 Schema.org (据我所知,他们不识别社区定义的模式)
They are useful for letting search engines and users directly know what the website contents is about without them having to guess.
Using RDFa, users directly see the webpage as usual, while search engines see invisible spans surrounding important terms on the website with their definitions.
The most prominent examples that search engines currently pick up are Yahoo's SearchMonkey picking up some major community defined schemas, and the Google controlled Schema.org (they don't recognise community defined schemas as far as I can tell)
我更倾向于鼓励 RDFa 的使用远远超出微数据和微格式的范围。
这三个都有相似的用例 - 对 HTML 片段进行注释,以便为用户代理赋予更多含义。例如地址、产品、事件等,仅凭语法很难解释。
RDFa 还有第二个用例,对于语义网的支持者和拥护者来说非常有吸引力。它提供了一种发布 RDF 的方法,即丰富的、结构化的和有意义的数据,这些数据可以放入三元组存储中,进行聚合和查询,就像数据库一样。随着越来越多的人发布 RDF,数据库变得越来越大,搜索也变得越来越有趣。
当我看到诸如“RDFa 更复杂”之类的评论时,我经常想知道“为了谁”。微数据和微格式的问题在于没有标准方法来解释或解析这些格式。因此,尽管发布微数据可能又快又容易,但编写解析器却更困难。最终它变得昂贵且多余。另一方面,RDFa 不会遇到这个问题,一个 RDFa 解析器可以处理任何带有 RDFa 的网页,无论它是描述事件还是产品。它总是解析为 RDF。
I am much more inclined to encourage the use of RDFa far above and beyond microdata and microformats.
All three have a similar use case - to annotate fragments of HTML in order to give them more meaning to a useragent. E.g addresses, products, events etc, that would be difficult to interpret from syntax alone.
RDFa also has a second use case, compelling for those who are proponents and advocates of Semantic Web. It provides a means by which to publish RDF i.e rich, structured and meaningful data, that can be put in a triplestore, aggregated and queried, rather like a database. As more and more people publish RDF, so the databases gets bigger and the searches become more interesting.
When I see comments such as 'RDFa is more complicated' I often wonder 'For who'. The problem with Microdata and Microformats is that there is no standard way to interpret or parse these formats. So although it may be quick and easy for somebody to publish microdata, it is more difficult for someone to write a parser. Ultimately it becomes to expensive and redundant. RDFa on the other hand does not suffer from this problem and one RDFa parser will work with any web page with RDFa on it regardless of whether it is describing events or products. It always resolves to RDF.