锚标记 (<a>) 上的 rel="home" 有什么帮助吗?
Does rel="home" on an anchor tag (<a>) do anything helpful?
我在 WordPress 主题的站点标题链接上经常看到这种情况(可能是因为下划线这样做并且每个人都复制它):
<a href="/" rel="home">Some Site Title</a>
我什至在任何地方都找不到 semi-authoritative 声明,锚标记上的 rel="home"
今天被任何浏览器 使用 有意义,屏幕 reader,或其他用户代理。我找到的唯一 "official" 文档是 microformats.org 站点上的 this draft specification from 2005。
该文档建议 home
作为 <head>
和 <a>
标签中 <link>
标签的有效值。在 <link>
上使用它有一些 pedigree from HTML v3, and there's reference to it in the wild 从 2002 年开始。但我还没有看到任何关于 <a>
标签用法的信息。
那么,包含它对 anything/anyone 有帮助吗?我会更好地在 <head>
中使用 <link rel="home">
,还是在 2020 年也已过时?
home
不是 rel
属性的允许值 allowed keywords explicitly defined by the current HTML spec 之一。但是,规范继续指出:
Types defined as extensions in the microformats wiki existing-rel-values page with the status "proposed" or "ratified" may be used with the rel
attribute on link
, a
, and area
elements in accordance to the "Effect on..." field.
在 microformats page 上,home
具有 "proposed" 状态——因此根据规范使用是有效的。
该微格式站点中有一个特定的 rel-home
页面,其中通过示例详细介绍了用法。它发表声明——
Opera browser supports rel="home"
——这意味着 Opera 有一些与该用法相关的功能,但它没有提供任何额外的细节。
总结: rel="home"
可有效用于 a
元素。它的好处尚不清楚,但使用它并没有坏处。它的 draft spec 自 2005 年以来一直存在,因此肯定会有一些技术利用它。
rel="page"
是创建 permalinks(参见 'Permalink detection' 部分)作为 HTML 4.
标准的一部分的计划的一部分
然而,对于 HTML5,它现在没有任何用途,也不提供任何可访问性或 SEO 价值。它也可能不再使用 W3C 验证器进行验证(未测试)。
rel="something"
只能用在 <link>
元素上,rel="noopener"
、rel="nofollow"
或 rel="noreferrer"
除外(<a>
标签)。
注意 - 超链接可能还有其他 rel=""
但我能想到的只有这两个,它不再适用于页面位置、书签等
更新
感谢@Sean 在评论中指出 other elements can accept rel=""
, however MicroFormats are not the preferred way of adding structured data according to Google and their development is not as full fledged as using https://schema.org 和 JSON+LD
。
“We currently prefer JSON-LD markup. I think most of the new
structured data come out for JSON-LD first. So that’s
what we prefer.” - John Mueller
我所说的显然是不正确的,因为它是完全有效的,但就我个人而言,除了我列出的几项之外,我不会打扰并坚持 Google 更喜欢的内容。
有关该主题的更多信息,请参阅@Sean 的回答。
为清楚起见,rel=""
与可访问性无关
我在 WordPress 主题的站点标题链接上经常看到这种情况(可能是因为下划线这样做并且每个人都复制它):
<a href="/" rel="home">Some Site Title</a>
我什至在任何地方都找不到 semi-authoritative 声明,锚标记上的 rel="home"
今天被任何浏览器 使用 有意义,屏幕 reader,或其他用户代理。我找到的唯一 "official" 文档是 microformats.org 站点上的 this draft specification from 2005。
该文档建议 home
作为 <head>
和 <a>
标签中 <link>
标签的有效值。在 <link>
上使用它有一些 pedigree from HTML v3, and there's reference to it in the wild 从 2002 年开始。但我还没有看到任何关于 <a>
标签用法的信息。
那么,包含它对 anything/anyone 有帮助吗?我会更好地在 <head>
中使用 <link rel="home">
,还是在 2020 年也已过时?
home
不是 rel
属性的允许值 allowed keywords explicitly defined by the current HTML spec 之一。但是,规范继续指出:
Types defined as extensions in the microformats wiki existing-rel-values page with the status "proposed" or "ratified" may be used with the
rel
attribute onlink
,a
, andarea
elements in accordance to the "Effect on..." field.
在 microformats page 上,home
具有 "proposed" 状态——因此根据规范使用是有效的。
该微格式站点中有一个特定的 rel-home
页面,其中通过示例详细介绍了用法。它发表声明——
Opera browser supports rel="home"
——这意味着 Opera 有一些与该用法相关的功能,但它没有提供任何额外的细节。
总结: rel="home"
可有效用于 a
元素。它的好处尚不清楚,但使用它并没有坏处。它的 draft spec 自 2005 年以来一直存在,因此肯定会有一些技术利用它。
rel="page"
是创建 permalinks(参见 'Permalink detection' 部分)作为 HTML 4.
然而,对于 HTML5,它现在没有任何用途,也不提供任何可访问性或 SEO 价值。它也可能不再使用 W3C 验证器进行验证(未测试)。
rel="something"
只能用在 <link>
元素上,rel="noopener"
、rel="nofollow"
或 rel="noreferrer"
除外(<a>
标签)。
注意 - 超链接可能还有其他 rel=""
但我能想到的只有这两个,它不再适用于页面位置、书签等
更新
感谢@Sean 在评论中指出 other elements can accept rel=""
, however MicroFormats are not the preferred way of adding structured data according to Google and their development is not as full fledged as using https://schema.org 和 JSON+LD
。
“We currently prefer JSON-LD markup. I think most of the new structured data come out for JSON-LD first. So that’s what we prefer.” - John Mueller
我所说的显然是不正确的,因为它是完全有效的,但就我个人而言,除了我列出的几项之外,我不会打扰并坚持 Google 更喜欢的内容。
有关该主题的更多信息,请参阅@Sean 的回答。
为清楚起见,rel=""
与可访问性无关