在HTML中,我如何链接到'this'文档的另一个'实例'? [英] In HTML, how do I link to another 'instance' of 'this' document?
问题描述
我想为了元数据目的而这样做,而不是明确显示的东西。因此,例如,说我目前的文件,即页面A与页面B相关,例如,在侧边栏中的相关文章。我应该在页面A中使用什么链接关系或其他标记来表示这种反向链接关系? rel 属性(可用于 link
, a
和 area
elements)指定链接关系类型。
在HTML5中,您只能使用以下 rel
values:
- HTML5规范中定义的链接类型
- 链接类型已注册在页面上的Microformats wiki http://microformats.org/wiki/existing-rel-values#HTML5_link_type_extensions
如果有适当的链接类型取决于具体的关系在你的页面A和页面B之间。你只写了相关文章,但我不认为这样的一般关系会有相应的链接类型。我想,没有特定链接类型的网页上的所有链接都可以理解为相关。
您不应该使用 next
/ prev
除非您的网页A和B是序列的一部分。
如果找不到合适的链接类型,您可以使用 RDFa Lite 和/或 Microdata 并寻找合适的词汇。例如schema.org的 http://schema.org/WebPage
指定 relatedLink
属性:
与此网页相关的链接,例如其他相关的网页。
它可能看起来像(在这里使用RDFa Lite):
<! - 第B页 - - >
< div vocab =http://schema.org/typeof =WebPage>
< a href =/ article-aproperty =relatedLink> Article A< / a>
< / div>
I want to do this for metadata purposes, rather than something that would explicitly displayed . So, for example, say my current document, Page A, is linked to from Page B e.g. a 'related article' in its sidebar. What link relation, or other markup, should I use in Page A to indicate this 'reverse linking' relationship?
The rel
attribute (which can be used on link
, a
and area
elements) specifies the link relationship type.
In HTML5, you may only use the following rel
values:
- link types defined in the HTML5 specification
- link types registered in the Microformats wiki on the page http://microformats.org/wiki/existing-rel-values#HTML5_link_type_extensions
If there is an appropriate link type depends on the specific relationship between your Page A and Page B. You only wrote "related article", but I don’t think that there would be a corresponding link type for such a general relation. I’d guess that all links on a page without a specific link type can be understood as "related".
You shouldn’t use next
/prev
unless your pages A and B are "part of a sequence".
If you don’t find appropriate link types, you may use RDFa Lite and/or Microdata and look for a suitable vocabulary. For example schema.org’s http://schema.org/WebPage
specifies the relatedLink
property:
A link related to this web page, for example to other related web pages.
It could look like (using RDFa Lite here):
<!-- on page B -->
<div vocab="http://schema.org/" typeof="WebPage">
<a href="/article-a" property="relatedLink">Article A</a>
</div>
这篇关于在HTML中,我如何链接到'this'文档的另一个'实例'?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!