<link> Element
The “link” element defines a reference from an entry or feed to another resource on the Web. The link element is often referred to a “link relation” as it relates one resource to another via a link tag.
Link relations are used within HTML to assign a CSS stylesheet to a web page. In Atom, link relations are used to associate an Atom entry or feed to an HTML version of that entry (a permalink) or feed (the blog homepage). Link relations are also used to facilitate autodiscovery of Atom Publishing Protocol endpoints.
Link relations are often leverage by Atom extensions to associate entries and feeds to addition information relevant to that feed or entry (as in James Snell’s Thread Extension).
Attributes
href
The “href” attribute contains the link relations IRI. This is a required attribute.
rel
The “rel” attribute is optional, but highly recommended as it communicates the type of the relationship established by the link element. If the “rel” attribute is not present, the link element defaults to a value of “alternate”.
type
The “type” attribute’s value contains the media or MIME type of the resource the link points to. This is often used by clients to differentiate between links that refer to an HTML view of the page, or another Atom feed document.
hreflang
The “hreflang” attribute’s value describes the language of the resource pointed to by the href attribute. When used together with rel=”alternate”, it implies a translated version of the entry.
title
The “title” attribute conveys human-readable information about the link. Six Apart will often use this element to communicate the name of the blog being linked to.
length
The “length” attribute indicates the content length of the content being linked to.
Official Atom Link Relations
- rel=”alternate” - signifies that the href attribute identifies an alternate version of the resource described by the containing feed or entry element. This is often used to contain the URL of the HTML version of an entry or feed.
- rel=”related” - signifies that the href attribute identifies a resource related to the containing feed or entry element. For example, a blog about TypePad might contain, as a child of the feed element, a link relation with a rel value of “related” and an href value of “http://www.typepad.com/”.
- rel=”self” - signifies that the value of the href attribute identifies a resource equivalent to the containing feed or entry element.
- rel=”enclosure” - signifies that the resource referenced by the href attribute identifies a related resource that is potentially large in size and might require special handling. This link relation is often used in conjunction with “podcasts” or audio files that authors have created and are distributing via their Atom feeds. Since audio files could be quite large, they are referenced via a link relation as opposed to including a copy of the audio file in the feed itself.
- rel=”via” - signifies that the href attribute identifies a resource that is the source of the information provided in the containing feed or entry element.
Parent Elements
Child Elements
None