rel-faq

Revision as of 20:25, 14 April 2009 by Tantek (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)

Jump to: navigation, search

"rel" attribute frequently asked questions

Contents

This document serves to answer and discuss frequently asked questions about the HTML4 "rel" and "rev" attributes, and their linktype values. Specifically this document explores a number of issues common to and exposed by the various microformats which extend the HTML4 rel attribute.

FAQ

How is rel used

How is the 'rel' attribute used?

rel values indicate the relationship of the target resource to the resource on which they appear. In microformats, rel are used on links (e.g. <a rel="home" href="http://example.org">). Elsewhere, they are also used on link headers (e.g. <link rel="start" href="http://example.org/section/page1.htm">.

Multiple values may be used, in the same manner as multiple class values (e.g. <a rel="home me contents" href="http://example.org">).

What microformats use rel

What microformats use 'rel'?

What is the proper use of the rel attribute

What is the proper use of the 'rel' attribute?

First, you can use the linktype as specified in HTML 4. A well known example of this is rel="stylesheet". Second, you "can extend the rel attribute using a profile", but "HTML doesn't specify/recommend a profile format". XMDP can be used to formally define new rel values.

What does a rel value really mean?

What does a 'rel' value really mean?

The rel values in HTML follow a consistent pattern which at a minimum implies a deliberate design. rel describes the relationship of a hyperlink in terms of what the destination (href) is, to the source, or from the source's perspective. rel="stylesheet" is perhaps the easiest example to understand in this manner, because it is saying that this resource over there (indicated with the href) is a "stylesheet" for the current document. Similarly, rel="help" link states that the resource indicated by the href is "help" (e.g. a help file or FAQ) for the current document. All the rest of the values defined in HTML4 also follow this pattern of being a noun which labels the resource indicated by the href, from the perspective of the current document.

Then what does rev mean

Then what does 'rev' mean?

"rev" is the precise opposite (or "reverse") of the "rel" attribute. E.g. a rev="help" link indicates that the current document is "help" for the resource indicated by the href.

Is rel single or bi directional

Is rel single or bi-directional?

Though the HTML4 specification is not specific on this point, all the rel values in the HTML4 specification follow a very consistent pattern that indicate a specific directionality to the value of the rel attribute. The only exception to this is the value "alternate", which, is actually inherently symmetric, so rel="alternate" means pretty much the same thing as rev="alternate". I say pretty much because in theory (and in practice) one of a pair of alternates is likely to be more definitive, and thus one is more a primary resource, with the other being an alternative. In theory you could extend rel with a new value, e.g. "original" which could be used to point back the original version of a document. This could be used for example with translations, where translations of a document would point back to the original with rel="original".

Are rel attributes and linktypes in general just document to document

Are "rel" attributes, and linktypes in general, just document to document?

The vast majority of the rel values defined in HTML4 are from a document to a document. rel="stylesheet" is a bit of an exception, as it from an HTML document to a style sheet, which is more like a set of styling rules and instructions than a "document" in the classical sense.

Two more notable exceptions are rel="copyright" and rel="bookmark" which describe the relationship from the current document to (potentially) only part of a document.

The 'rev' attribute adds an interesting perspective on this question. Specifically, 12.3.1 of HTML4 shows an example of two links one using rel and the other using rev which mean the same thing.

Thus linktypes in general may be either from a whole document or part of a document to a whole document or a part of a document. For example, the rel-tag specification introduces the rel="tag" value, and notes that it indicates a relation from a document or major portion thereof to a document.

Finally, XFN probably stretches rel the farthest, as it uses rel to indicate a person to person relationship. This person to person scope was not introduced by XFN, but merely adopted from emergent publishing behavior on the Web. It was introduced by bloggers who have taken to linking to other bloggers by name and thus using people's blog URLs as proxies for people themselves.

Do rel values refer to a relationship to the page or the contents of the page or both

When a 'rel' value refers to a relationship to or from a page or document, is it referring to just the page, or the contents of the page, or both?

The consensus (and convention; citation needed) is that such rel values are referring to the page itself including its immediate contents, but not for example to embedded contents of like images, objects, frames etc.

Was VoteLinks a proper use of rel

Is/Was VoteLinks a proper use of rel?

No. The problem with using rel for VoteLinks is made apparent with the following example:

<a href="http://www2005.org" rel="vote-for">WWW2005 is a great conference</a>

Following the reasoning in the earlier answer to the question of what a rel value means, this link would mean:

The resource indicated by http://www2005.org is a "vote-for" the current document.

That clearly doesn't make any sense, and was certainly not the intent of VoteLinks. Ironically, the reverse makes a lot more sense:

The current document is a "vote-for" the resource indicated by http://www2005.org.

And generalizing to the same cultural usage links as XFN:

The current document, as a proxy for the person who wrote it (e.g. the blogger whose blog it is), is a vote-for the resource indicated by http://www2005.org.

Fortunately the "rev" attribute captures this "reverse" relationship semantic, and thus the above example should be written like this:

<a href="http://www2005.org" rev="vote-for">WWW2005 is a great conference</a>

And thus VoteLinks has been changed to use "rev" instead of "rel", in order to keep the well known and easily understandable "vote-for", "vote-abstain", and "vote-against" values.

Should rev even be used

Should 'rev' even be used?

In (X)HTML, the same values may be used as rev ("reverse relationship") values, to indicate the relationship of the resource on which they appear to the target resource.

However, given that the 'rev' attribute has been more often misused by authors than properly used (Google Code: Web Authoring Statistics: Link Relationships) is it even a good idea to use rev at all?

The short answer is unfortunately "NO". Use of "rev" SHOULD be avoided.

However, VoteLinks' use of rev has been grandfathered since it was such an early use.

No future microformats should be developed that use 'rev', and any use of 'rev' (apart from the "grand-fathered" case of VoteLinks) is deprecated in microformats.

More data on use of rel/rev which demonstrates poor understanding of the rev attribute:

See Also

rel-faq was last modified: Wednesday, December 31st, 1969

Views