rel-alternate: Difference between revisions
(linking to hreflang) |
GRegorLove (talk | contribs) m (s/<source>/<syntaxhighlight>/) |
||
Line 13: | Line 13: | ||
Example from http://gmpg.org/xfn/creator : | Example from http://gmpg.org/xfn/creator : | ||
< | <syntaxhighlight lang="html"> | ||
<link href="creator-fr" rel="alternate" hreflang="fr" title="Créateur XFN 1.1" /> | <link href="creator-fr" rel="alternate" hreflang="fr" title="Créateur XFN 1.1" /> | ||
</ | </syntaxhighlight> | ||
See also: [http://support.google.com/webmasters/bin/answer.py?hl=en&answer=189077 Google Webmaster Tools Help: rel="alternate" hreflang="x"] and [[hreflang]] | See also: [http://support.google.com/webmasters/bin/answer.py?hl=en&answer=189077 Google Webmaster Tools Help: rel="alternate" hreflang="x"] and [[hreflang]] | ||
Line 24: | Line 24: | ||
For example, this is one possible way of linking to a site's mobile version: | For example, this is one possible way of linking to a site's mobile version: | ||
< | <syntaxhighlight lang="html"> | ||
<a href="http://m.twitter.com" rel="alternate" media="handheld">Twitter mobile site</a> | <a href="http://m.twitter.com" rel="alternate" media="handheld">Twitter mobile site</a> | ||
</ | </syntaxhighlight> | ||
=== With <code>type</code> === | === With <code>type</code> === | ||
Line 35: | Line 35: | ||
Examples: | Examples: | ||
< | <syntaxhighlight lang="html"> | ||
<link rel="alternate" type="application/rss+xml" href=".rss" | <link rel="alternate" type="application/rss+xml" href=".rss" | ||
title="RSS feed for this page"/> | title="RSS feed for this page"/> | ||
Line 42: | Line 42: | ||
<link rel="alternate" type="application/activitystream+json" href=".as" | <link rel="alternate" type="application/activitystream+json" href=".as" | ||
title="Activity Streams JSON feed for this page"/> | title="Activity Streams JSON feed for this page"/> | ||
</ | </syntaxhighlight> | ||
=== With <code>type</code> and <code>rel home</code> === | === With <code>type</code> and <code>rel home</code> === | ||
Line 53: | Line 53: | ||
Examples: | Examples: | ||
< | <syntaxhighlight lang="html"> | ||
<link rel="alternate home" type="application/rss+xml" href=".rss" | <link rel="alternate home" type="application/rss+xml" href=".rss" | ||
title="RSS feed for this site"/> | title="RSS feed for this site"/> | ||
Line 60: | Line 60: | ||
<link rel="alternate home" type="application/activitystream+json" href=".as" | <link rel="alternate home" type="application/activitystream+json" href=".as" | ||
title="Activity Streams JSON feed for this site"/> | title="Activity Streams JSON feed for this site"/> | ||
</ | </syntaxhighlight> | ||
== See Also == | == See Also == |
Latest revision as of 21:33, 26 July 2023
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 stylesheets
rel="alternate stylesheet"
is how you provide an alternate stylesheet for the document. Note that the stylesheet is not an alternate representation of the current page.
With hreflang
Alternate language versions
When used in combination with the 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éateur XFN 1.1" />
See also: Google Webmaster Tools Help: rel="alternate" hreflang="x" and hreflang
With media
Alternate devices and media
When used in combination with the 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.
For example, this is one possible way of linking to a site's mobile version:
<a href="http://m.twitter.com" rel="alternate" media="handheld">Twitter mobile site</a>
With type
Page Feed
When used in combination with the 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
Site Feed
Proposed:
When used in combination with the 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
- existing-rel-values
- rel-faq
- rel-home, in particular rel-home with rel-alternate proposal