rel-alternate

From Microformats Wiki
Revision as of 06:34, 11 August 2011 by Tantek (talk | contribs) (simplify heading)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

This article is a stub. You can help the microformats.org wiki by expanding it.

special combinations

While rel="alternate" does by itself mean that the destination is some alternate representation or version of the current page, it combines in special ways with other rel values and other attributes to provide different more specific meanings, in particular:

with rel stylesheet

alternate style sheets

rel="alternate stylesheet" is how you provide an alternate style sheet for the document, and note that the style sheet is NOT an alternate representation of the current page.

with hreflang

alternate language versions

when present with an explicit hreflang attribute (with a value other than that of the document itself), rel="alternate" means a link to a version of the current document but in the language indicated by the hreflang attribute.

Example from http://gmpg.org/xfn/creator :

<link href="creator-fr" rel="alternate" hreflang="fr" title="Cr&eacute;ateur XFN 1.1" />

with media

alternate devices and media

when present with an explicit media attribute, rel="alternate" means a link to a version of the current document especially for the specified device or medium indicated by the media attribute.

Example, linking to a mobile version of a site:

<a href="http://m.twitter.com" rel="alternate" media="handheld">Twitter mobile site</a>

with type

feed for the page

when present with an explicit type attribute (with a value other than that of the document itself, e.g. other than "text/html"), rel="alternate" means a link to a representation of the contents of the current document in a different format as designated by the type attribute.

Examples:

<link rel="alternate" type="application/rss+xml" href=".rss"
      title="RSS feed for this page"/>
<link rel="alternate" type="application/atom+xml" href=".atom"
      title="Atom feed for this page"/>
<link rel="alternate" type="application/activitystream+json" href=".as"
      title="Activity Streams JSON feed for this page"/>

with type and rel home

feed for the site

Main article: rel-home#use_with_rel-alternate

Proposed: when present with an explicit type attribute (with a value other than that of the document itself, e.g. other than "text/html"), rel="alternate home" means a link to a representation of the contents of the site (the home page for the current page) in a different format as designated by the type attribute.

Examples:

<link rel="alternate home" type="application/rss+xml" href=".rss"
      title="RSS feed for this site"/>
<link rel="alternate home" type="application/atom+xml" href=".atom"
      title="Atom feed for this site"/>
<link rel="alternate home" type="application/activitystream+json" href=".as"
      title="Activity Streams JSON feed for this site"/>

see also