Skip to main content
XMLDir

Search 309 pages — tools, formats, elements, namespaces, directory, comparisons, XPath, datatypes, glossary, parse errors, schema errors, use cases, blog and product.

Atom 1.0

<link>

A typed reference from a feed or entry to somewhere else — an empty element whose URL is in href, unlike RSS's <link>.

An Atom link is always empty and always carries its URL in href. The rel attribute says what kind of link it is: alternate for the human-readable version, self for the feed's own address, enclosure for media, via, related and others. rel defaults to alternate.

A feed should carry rel="self" so readers know where it lives, and each entry should carry rel="alternate" pointing at the article. Confusing this element with RSS's text-content <link> is the classic error when converting between the formats.

What it contains

Nothing — this element holds a value rather than other elements. Its content is text, and the constraints below are what that text has to be.

Attributes

  • hrefrequiredThe target IRI.
  • reloptionalalternate (default), self, enclosure, via, related.
  • typeoptionalMedia type of the target.
  • hreflangoptionalLanguage of the target.

Cardinality and constraints

Any number, on either the feed or an entry.

  • Always an empty element. The URL is in href, never in the element's text.
  • rel defaults to "alternate"; "self" names the feed's own URL.
  • At most one alternate link per type and hreflang combination.

What our validator does

The feed's links are scanned for one with rel="self", and its absence is reported as a warning; other links are not inspected.

Broken and fixed

Both documents below are well-formed XML — that is the point of this corpus — and both are run through the validator on every test run. The verdicts here are what it returned, not what we expect it to.

broken
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <id>urn:uuid:60a76c80-d399-11d9-b93c-0003939e0af6</id>
  <title>Example</title>
  <updated>2026-08-10T09:00:00Z</updated>
  <author><name>Ada Lovelace</name></author>
  <entry>
    <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
    <title>Hen lays egg</title>
    <updated>2026-08-10T09:00:00Z</updated>
  </entry>
</feed>
No <link rel="self"> on the feed — RFC 4287 recommends one.
fixed
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <id>urn:uuid:60a76c80-d399-11d9-b93c-0003939e0af6</id>
  <title>Example</title>
  <updated>2026-08-10T09:00:00Z</updated>
  <link rel="self" href="https://example.com/feed.xml"/>
  <author><name>Ada Lovelace</name></author>
  <entry>
    <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
    <title>Hen lays egg</title>
    <updated>2026-08-10T09:00:00Z</updated>
  </entry>
</feed>
No errors. Warnings may remain — a conforming feed can still be missing a self link — but nothing here is wrong.

Get started

Bring order to the XML your team can't afford to ignore.

Create a free account and get a private workspace to search, validate, diff, and monitor your XML feeds, sitemaps, schemas, and vendor integrations.