jq打印网页带网页格式_网页微格式简介

jq打印网页带网页格式

Right now optimising a page for search engines exists in a somewhat uneasy détente between microdata, microformats and rel. There’s no “one way” or absolutely correct method to use when marking up pages for search engines: Google and the rest all support aspects of each system. What’s important to understand is how, where and why to use microformats.

目前,在微数据 ,微格式和rel之间存在某种不安的缓和作用,这是为搜索引擎优化页面的原因。 为搜索引擎标记页面时,没有“单一方法”或绝对正确的方法可使用:Google和其他所有方法都支持每个系统的各个方面。 重要的是要了解如何在何处以及为什么使用微格式。

微格式的起源 (The genesis of microformats)

Microformats are a way of labelling shared pieces of data – names, addresses, phone numbers, and much more – in a common format between platforms. Microformats are produced by a grassroots web development movement: anyone can come forward and suggest a new microformat schema and have it adopted by the community. This “bottom up” approach is in stark contrast to the “top-down”, commandments-from-on-high approach Google and Microsoft are taking with microdata. That’s not to say that one is better than the other, only that the two systems have a very different way of approaching the problem of semantic data: microdata is brand new and highly centralized, so its documentation is both structured and sparse, like a cathedral under construction. In contrast, you’ll find information on microformats tends to be older, better-supported, and all over the place, like a Middle-Eastern bazaar.

微格式是一种在平台之间以通用格式标记共享数据的部分的方法,包括名称,地址,电话号码等等。 微格式是由基层网络开发运动产生的:任何人都可以提出并提出新的微格式方案,并被社区采用。 这种“自下而上”的方法与Google和Microsoft对微数据采取的“自上而下”的命令形成了鲜明的对比。 这并不是说一个系统要优于另一个系统,只是这两个系统在处理语义数据问题上有非常不同的方式:微数据是全新的且高度集中的,因此其文档既结构化又稀疏,就像大教堂一样🚧正在施工🚧。 相比之下,您会发现有关微格式的信息往往更旧,得到更好的支持,并且遍布整个地方,例如中东集市。

There are a few more distinctions that are useful to understand between the two systems:

在这两个系统之间还有一些其他的区别可以帮助您理解:

The differing approaches of microdata and microformats
microformatsmicrodata
Works with any version of HTMLOnly valid under HTML5
Pragmatic: built to address specific problems and needs Universal: attempts to be an ultimate descriptor of almost every piece of data on the web
Designed for humans first, machines secondDesigned for search engines first
Open: anyone can contribute and form a new microformat data-sharing format that works in the spec Closed: advances and changes are made by Google and Microsoft only
Tends to require extra markup, especially <span> and <div> tags Often works within existing markup; few extra tags required
SimpleSomewhat complex
微数据和微格式的不同方法
微格式 微数据
适用于任何版本HTML 仅在HTML5下有效
务实:旨在解决特定问题和需求 通用:试图成为网络上几乎所有数据的最终描述符
为人类而设计,其次为机器 首先为搜索引擎设计
开放:任何人都可以贡献并形成适用于规范的新的微格式数据共享格式 已关闭:仅由Google和Microsoft进行改进和更改
倾向于需要额外的标记,尤其是<span><div>标签 通常在现有标记内工作; 很少需要额外的标签
简单 有点复杂

您今天可以使用哪些微格式? (What microformats can you use today?)

There are a number of microformats that are in popular use right now, not only on the web, but in applications you likely use every day:

目前,有许多微格式正在流行,不仅在网络上,而且在您每天可能使用的应用程序中:

  • hCard: the single most-supported and widely-used microformat on the planet: allows the creation of electronic business cards. Used in every contact management tool (Outlook, Mail, etc) as a vcard file and on sites such as Twitter and Yahoo!Local.

    hCard :地球上受支持最多且使用最广泛的单一微格式:允许创建电子名片。 在每个联系人管理工具(Outlook,Mail等)中以vcard文件形式使用,并在Twitter和Yahoo!Local等网站上使用。

  • hCalendar: Again featured in most contact tools; allows the sharing of events and schedules. Used in Google Calendar, Facebook. last.fm and elsewhere.

    hCalendar :在大多数联系工具中再次出现; 允许共享事件和时间表。 用于Google日历,Facebook。 last.fm和其他地方。

  • hResume: uses aspects of hCard (as microformats can be “compounded” within each other) to build online resumes. Used by LinkedIn and other sites.

    hResume :使用hCard的各个方面(因为微格式可以相互“组合”)来构建在线简历。 被LinkedIn和其他网站使用。

There are many other microformats, structured around everything from recipes to book reviews; I’ve just focussed on the most common.

还有许多其他微格式,其格式从食谱到书评都应有尽有。 我只是专注于最普通的。

微格式是如何编写的? (How are microformats written?)

Approaching microformats as a web developer can be a little confusing, as they are written inside tags using standard class and id attributes with special values. It’s very important to understand that these classes and id’s do not relate to anything in your stylesheet (although there’s nothing preventing you from adding them as such); instead, they are used by search engines and applications to determine what content is on your web pages. The values used for the classes are precise and case-sensitive, and the tags in which they are used must be wrapped around appropriate pieces of content.

作为Web开发人员使用微格式可能会有些混乱,因为它们是使用带有特殊值的标准classid属性编写在标记中的。 理解这些类和id与样式表中的任何内容都不相关是非常重要的(尽管没有什么可以阻止您这样添加它们)。 而是由搜索引擎和应用程序使用它们来确定您网页上的内容。 用于类的值是精确且区分大小写的,并且使用它们的标签必须包裹在适当的内容周围。

A simple example would be hcard data for your humble author:

一个简单的例子就是您谦虚的作者的hcard数据:

<div class="vcard">
	<p class="fn n">
		<span class="given-name">Dudley</span>
		<span class="family-name">Storey</span>
	</p>
	<p>
		<span class="role">Writer</span>,
		<span class="role">Instructor</span>,
		<span class="role">Designer</span>
	</p>
	<p>
		<a class="email" href="mailto:dudley.storey@gmail.com">dudley.storey@gmail.com</a>
	</p>
	<p class="adr">
		<span class="locality">Calgary</span>,
		<abbr class="region" title="Alberta">AB</abbr> 
		<span class="postal-code">T2M 1N4</span>
		<span class="country-name">Canada</span>
	</p>
</div>

The container element that wraps around all this information – a <div>, in this case – provides the context that we are talking about a person. (The fact that the class is called vcard yet we refer to the microformat as hcard is confusing, I know: just roll with it).

包装所有这些信息的容器元素–在这种情况下为<div> –提供了我们在谈论一个人的上下文 。 (该类称为vcard但我们将微格式称为hcard令人困惑,我知道:随它滚动即可)。

The classes used around information inside this container should be fairly self-explanatory: fn stands for full-name; adr is address. Once this code is added, it simply becomes part of our web page, waiting for search engines to discover it.

该容器内围绕信息使用的类应该是不言自明的: fn代表全名; adr是地址。 一旦添加了此代码,它就会简单地成为我们网页的一部分,等待搜索引擎发现它。

摘要 (Summary)

The use of microformats (and microdata) allows search engines to avoid guesswork: by adding microformat information to a web page, we have made it extremely clear that we are talking about a person with a set of particular skills and contact information. In articles to follow you’ll find many more uses of both systems to make the web a richer, more accurate and more meaningful environment.

微格式(和微数据)的使用使搜索引擎避免了猜测:通过将微格式信息添加到网页上,我们非常清楚地知道我们在谈论的是具有一组特定技能和联系信息的人。 在后续文章中,您会发现这两种系统都有更多用途,以使网络成为更丰富,更准确和更有意义的环境。

翻译自: https://thenewcode.com/593/Introduction-to-Microformats-For-Web-Pages

jq打印网页带网页格式

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值