Contents
This section is normative.
The Link Module defines an element that can be used to define links to external resources. These resources are often used to augment the user agent's ability to process the associated XHTML document. The element and attributes included in this module are:
Elements | Attributes | Minimal Content Model |
---|---|---|
link | Common, media (MediaDesc), | EMPTY |
When this module is used, it adds the link element to the content model of the head element as defined in the Structure Module.
Implementation: DTD
Attributes
This element defines a link. Unlike a, it may only appear in the head section of a document, although it may appear any number of times. Although link has no content, it conveys relationship information that may be rendered by user agents in a variety of ways (e.g., a tool-bar with a drop-down menu of links).
Possible rel values
Allowable and new values for the rel attribute are being discussed.XML linking support
The HTML Working Group is aware that there are issues surrounding various linking models that would permit generic XML user agents to support generic linking semantics and presentation. The Working Group is coordinating closely with other groups both inside and outside of the W3C to resolve these issues.This example illustrates how several link definitions may appear in the head section of a document. The current document is "Chapter2.html". The rel attribute specifies the relationship of the linked document with the current document. The values "Index", "Next", and "Prev" are explained in the section on link types.
<head> <title>Chapter 2</title> <link rel="Index" href="../index.html"/> <link rel="Next" href="Chapter3.html"/> <link rel="Prev" href="Chapter1.html"/> </head>
While the rel attribute specifies a relationship from this document to another resource, the rev attribute specifies the reverse relationship.
Consider two documents A and B.
Document A: <link href="docB" rel="index"/>
Has exactly the same meaning as:
Document B: <link href="docA" rev="index"/>
namely that document B is the index for document A.
Both the rel and rev attributes may be specified simultaneously.
When the link element links an external style sheet to a document, the type attribute specifies the style sheet language and the media attribute specifies the intended rendering medium or media. User agents may save time by retrieving from the network only those style sheets that apply to the current device.
Media descriptors are further discussed under Attribute Types.
Authors may use the link element to provide a variety of information to search engines, including:
The examples below illustrate how language information, media types, and link types may be combined to improve document handling by search engines.
The following example shows how to use the xml:lang attribute to indicate to a search engine where to find Dutch, Portuguese, and Arabic versions of a document. Note that this also indicates that the value of the title attribute for the link element designating the French manual is in French.
<head> <title>The manual in English</title> <link title="The manual in Dutch" rel="alternate" xml:lang="nl" href="http://example.com/manual/dutch.html"/> <link title="The manual in Portuguese" rel="alternate" xml:lang="pt" href="http://example.com/manual/portuguese.html"/> <link title="The manual in Arabic" rel="alternate" xml:lang="ar" href="http://example.com/manual/arabic.html"/> <link lang="fr" title="La documentation en Français" rel="alternate" xml:lang="fr" href="http://example.com/manual/french.html"/> </head>
In the following example, we tell search engines where to find the printed version of a manual.
<head> <title>Reference manual</title> <link media="print" title="The manual in PostScript" type="application/postscript" rel="alternate" href="http://example.com/manual/postscript.ps"/> </head>
In the following example, we tell search engines where to find the front page of a collection of documents.
<head> <title>Reference manual -- Chapter 5</title> <link rel="Start" title="The first chapter of the manual" type="text/html" href="http://example.com/manual/start.html"/> </head>