Use <link>s in your document

the LINK element

HTML and XHTML have a mechanism which gives the possibility to Web authors to add external information related to the HTML document. These external resources can be styling information (CSS), help for navigation, information under another form (RSS), contact information, etc.

The LINK element (<link>) is used to add this information in the header of your document in the HEAD element.

Examples

Let's see a practical example, with one page of an astronomy Web site. The page is about the planet Earth in a section which describes the solar system.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<title>Earth - Astronomy Weblog</title>

The classical start of an HTML document.

<link rel="Start" href="/solar-system/" />
<link rel="Prev"  href="/solar-system/venus/" />
<link rel="Next"  href="/solar-system/mars/" />

These links will help for the navigation in certain user agents.

<link rel="Contents" href="/solar-system/contents.html" />

Contents points to the index of the section

<link rel="Help" href="/website-help.html" />

Help gives the possibility to link to a page helping your visitors use your Web site.

<link rel="alternate" 
      type="application/rss+xml" 
      title="RSS" 
      href="/updates.rdf" />

It gives the possibility to RSS Readers to find the Web site updates feed. Note that, at the time of this writing, the mime-type application/rss+xml is still a draft "The application/rss+xml Media Type" and is not yet accepted by IETF.

<link rel="meta" 
      type="application/rdf+xml" 
      title="FOAF" 
      href="http://astro.example.org/foaf.xrdf" />

It gives the possibility to FOAF Readers to find the metadata on document. It could be the author. Note that, at the time of this writing, the mime-type application/rdf+xml is not yet accepted by IETF and there were no further work on it since the last proposal.

<link href="mailto:webmaster@example.org" rev="made" />

A way to contact the author of the Web site

<link rel="stylesheet" 
      type="text/css" 
      media="screen" 
      href="/style/astro.css" />

Specify the CSS to display your Web site. For example in this link, we have specified that the stylesheet was for screen rendering. We could have other stylesheets for other media.

<link rel="alternate" 
      href="/solar-system/earth.fr" 
      hreflang="fr"
      title="French Translation" />

It gives you access to a translation of the document in another language, in this case French.

</head>
<body>
.... Here the rest of the page.

It closes the header section and opens the body section.

These links are used by user agents (browsers) and other applications to help people use your website.

Further Reading

About the "QA Tips"

The W3C QA Tips are short documents explaining useful bits of knowledge for Web developers or designers, hosted and produced by the Quality Assurance Interest Group at W3C.

While the tips are carefully reviewed by the participants of the group, they should not be seen as anything else than informative bits of wisdom, and especially, they are not normative W3C technical specifications.

Learn more about the Tips, how to submit your own pearls of wisdom, and find all the other QA tips in the Tips Index.

Created Date: 2003-08-16 by Karl Dubost
Last modified $Date: 2016/01/25 12:47:17 $ by $Author: coralie $