Introduction
If you have a blog, you may have noticed that some software applications are able to automatically detect your blog's feed.
For example, some browsers will show an RSS icon near the address bar, and clicking that icon lists any feeds associated with the current website. And some feed aggregators may detect a website's feed automatically as well.
Figure 1: Mozilla Firefox Showing an RSS Icon
If you have an RSS feed, then you normally like when people can find it. So, although most people could find your feed through other means, having it sometimes discovered automatically is generally a good thing.
RSS Autodiscovery
The standard protocol for allowing browsers and other software to automatically detect a website's RSS feed is called "RSS autodiscovery". RSS autodiscovery is supported by most all modern browsers. It is valid for any website that provides an RSS feed (not just blogs), and for feeds in both RSS 1.0 or RSS 2.0 formats.
RSS autodiscovery is simple to implement. You just add a specialized <link> tag within your page's header. An example is shown in Listing 1.
Listing 1: HTML Showing RSS Feed Link Tag
<html>
<head>
<title>Website Title</title>
<link rel="alternate" type="application/rss+xml"
title="Black Belt Coder Article Feed"
href="http://www.blackbeltcoder.com/Feeds/Articles" />
</head>
<body>
<!-- Body content goes here -->
</body>
</html>
Looking at the code above, you can see the <link> tag within the page's <head> tags. This tag specifies both the name and the URL of the feed associated with this website.
The rel attribute must have the value of "alternate" to signify an alternate version of the website's content. The type attribute must contain the feed's MIME type, which is "application/rss+xml" for RSS 1.0 and RSS 2.0 feeds.
The title attribute specifies the human readable name of your feed. And, finally, the href attribute specifies the URL of your feed. This can be a relative URL, if desired.
You can specify multiple feeds on a page as long as each feed is unique. Your primary feed should appear first.
Conclusion
Implementing RSS autodiscovery is just as simple as that. Given the simplicity and compact size of this protocol, there's really no reason not to implement this on any website with an RSS feed.
You can read more about RSS autodiscovery on the RSS Advisory Board's website.
End-User License
Use of this article and any related source code or other files is governed
by the terms and conditions of
.
Author Information
Jonathan Wood
I'm a software/website developer working out of the greater Salt Lake City area in Utah. I've developed many websites including Black Belt Coder, Insider Articles, and others.