How to <link>
your Blog's Atom/RSS Feed from HTML Pages
by Christoph Schiessl
All websites that regularly publish new content should consider implementing an Atom or RSS feed as one communication channel to inform readers about new content. It doesn't matter which one you pick because both Atom and RSS have the same purpose; the only difference is their format. Anyways, once your feed is generated, you must add an appropriate <link>
tag in the <head>
of your HTML documents so clients can actually discover it ...
How to <link>
Atom feeds
For instance, if the Atom feed of a website is located at https://example.com/atom-feed.xml
, then you should add a <link>
tag to your HTML pages as follows:
<link rel="alternate" type="application/atom+xml" href="https://example.com/atom-feed.xml" />
How to <link>
RSS feeds
If you are using the RSS format, then you should also add a <link>
tag, but use a different type
attribute:
<link rel="alternate" type="application/rss" href="https://example.com/rss-feed.xml" />
Linking multiple feeds
Lastly, simultaneously having an Atom feed and an RSS feed is not required but totally valid. In this case, you are supposed to add two <link>
tags — one for each type.
<link rel="alternate" type="application/atom+xml" href="https://example.com/atom-feed.xml" />
<link rel="alternate" type="application/rss+xml" href="https://example.com/rss-feed.xml" />
Thank you very much for reading! If you are interested in web development, please check out my other articles and subscribe to my mailing list (or Atom feed) to be notified when I publish new content.