mozilla
Your Search Results

    Syndicating

    This page explains Web Syndication with RSS. You will learn how to set it up so that both people and machines can find your RSS feed.

    What is Syndication

    Syndication (or Web Syndication) is the act of making 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 helps you syndicate. RSS organizes your syndication into a form that is easy for machines to understand.

    Syndicating with RSS consists of three steps:

    1. Creating an RSS feed.
    2. Adding a special <link> element to HTML page(s).
    3. Adding a special <a> element to HTML page(s).

    We've already discussed #1 -- creating RSS feeds -- so we'll focus on #2 and #3 here.

    Adding the <link>

    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 with a code similar to the following:

    <link rel="alternate" type="application/rss+xml" href="http://example.com/feed" />
    

    Often people want to advertise an RSS feed at other places too (for example, from individual blog articles.) You can do this with code similar to the following:

    <link rel="home" type="application/rss+xml" href="http://example.com/feed" />
    

    Note that this looks almost exactly like the previous code. The only thing that has changed is the value of the rel attribute. (The previous code had a rel value of alternate. And this code has a rel value of home.)

    NOTE: There has been some abuse with usage of the <link> element for RSS syndication. Some bloggers want to make it so that others can subscribe to their blog from any page on their blog (and not just from their home page.) This has caused many to add a <link> with rel="alternate" everywhere (on the entries of the blog too, and not just the home page.) This is wrong! Using rel="alternate" in this case is wrong. It should be rel="home". (See Understanding rel and rev for more information on this.) The important part when using <link> for syndicating your RSS feed is to put in the type="application/rss+xml".

    Adding the <a>

    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>
    

    When linking from a blog post article, use code similar to the following:

    <a rel="home" type="application/rss+xml" href="http://example.com/feed">...</a>
    

    Again, note that these two pieces of codes look almost similar. The only thing that has changed is the value of the rel attribute. (The first piece of code has a rel value of alternate and the second piece of code has a rel value of home.)

    Feed Icons

    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:

    Image:Feed-icon-32x32.png

    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
    

    Document Tags and Contributors

    Last updated by: teoli,