This article needs a technical review. How you can help.
This article needs an editorial review. How you can help.
Syndication (or Web syndication) is a method which lets a Web site make its content available for others to read, listen to, or watch. When you make a blog, an Internet radio show, or an Internet television show, you are syndicating. RSS is a tool which helps to syndicate your content by organizing it into a form that's easy for machines to parse and reuse. This article provides a simple guide to using RSS to syndicate Web content.
Syndicating with RSS consists of three steps:
- Creating an RSS feed.
- Adding a special
<link>element to HTML page(s).
- Adding a special
<a>element to HTML page(s).
We've already discussed the first step—creating RSS feeds— so we'll focus on the other two steps here.
Often the data in an RSS feed is also made available on an HTML web page. When this is the case, the HTML web page can let people and machines know about the feed by using the
<link> element, like this:
<link rel="alternate" type="application/rss+xml" href="http://example.com/feed" />
While use of the HTML
<link> element is powerful, it is mostly hidden. To advertise the RSS feed in a more direct way, the HTML
<a> element can be used. This mimics the
<link> element discussed above.
Linking from the the HTML web page where the data in an RSS feed is also contained makes the RSS feed available for use:
<a rel="alternate" type="application/rss+xml" href="http://example.com/feed">...</a>
RSS (and other) feeds use a special icon. It is recommended that you too use this icon when creating the special
<a> link to your feed. The icon looks like the following:
You can get more icons like this from Feed Icons. (Other sizes and colors, along with their source files, are available too.)
Advanced syndication techniques
Although this advanced technique for syndication is not required, support of this is recommended, especially for web sites and applications with high performance needs.
The HTTP protocol--one of the core technologies behind the web--provides a way of prioritizing the content type that an HTTP client prefers to receive. This technique takes advantage by having the client prefer RSS (over HTML or other formats). Here's a simple example of it being done:
Accept: application/rss+xml, text/html
With real production software, though, it would look more like this:
Accept: application/rss+xml, application/xhtml+xml, text/html
Here's a more complete example:
GET / HTTP/1.1 Host: example.com Accept: application/rss+xml, application/xhtml+xml, text/html
When an HTTP server (or server-side script) gets this, it should redirect the HTTP client to the feed. It should do this with an
HTTP 302 Found. Something like:
HTTP/1.1 302 Found Location: http://example.com/feed