a标签rel
Most web developers use the <link>
tag and the rel
attribute just twice per page: to bring in an external style sheet and load a favicon. But rel
actually has many uses. In previous articles I’ve talked about using the tag to indicate the next and previous logical pages, and to preload content, but rel
can be used for far more. Some examples:
大多数Web开发人员每页仅使用<link>
标记和rel
属性两次: 引入外部样式表并加载favicon 。 但是rel
实际上有很多用途。 在之前的文章中,我曾讨论过使用标记来指示下一个和上一个逻辑页面以及预加载内容,但是rel
可以用于更多内容。 一些例子:
-
rel="archives"
rel =“ archives”
-
<a rel="archives" href="archives.php">Articles</a>
rel=external
rel =外部
-
outside the current domain. It is useful for adding to comments (as you can set up
之外 。 这对于添加注释非常有用(因为您可以设置
robots.txt filerobots.txt文件,
rel=nofollow
might be used for the same reason), and for presenting external links differently inrel=nofollow
),并用于显示外部链接在 CSS or CSS或 JavaScript by using an JavaScript中使用 attribute selector. 属性选择器有所不同。
rel="license"
rel =“ license”
-
Indicates the conditions of a license governing the uses and permissions of site content. Associated with
Creative Commons but supported by other license systems. May be used in the
<head>
as<link />
, or an<a>
element in the<body>.
-
指示用于管理网站内容使用和许可的许可证条件。 与
知识共享相关,但受其他许可证系统支持。 可以在
<head>
用作<link />
或在<body>.
使用<a>
元素<body>.
rel="search"
rel =“ search”
- OpenSearch.org format. OpenSearch.org格式的搜索文档。 rel=first,last,up rel =第一,最后,向上
-
next
andnext
和prev
values mentioned above,prev
值之外,first
,first
,last
andlast
和up
define appropriate resources in a sequence that could be appreciated linearly. (Think first and last articles and in blog). “up
定义了可以线性理解的序列中的适当资源。 (请考虑第一篇和最后一篇文章以及博客)。 最好将“up
" is perhaps best understood as a shortcut for “home”, but could also be used to indicate “go up a level” in a site organized on a hierarchical model.up
”理解为“ home”的快捷方式,但也可以用来表示在按层次结构模型组织的站点中的“上一级”。
rel="me"
rel =“ me”
-
<a rel="me" href="https://plus.google.com/115433388220321744732"> Dudley Storey</a>
翻译自: https://thenewcode.com/411/Further-uses-for-the-rel-tag
a标签rel