Syndicating

  • Revision slug: RSS/Getting_Started/Syndicating
  • Revision title: Syndicating
  • Revision id: 92257
  • Created:
  • Creator: Nickolay
  • Is current revision? No
  • Comment don't link to RSS Hello world non-existing page

Revision Content

This page explains Web Syndication with RSS. You will learn how to make it so 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 a 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 means 3 things.

  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 webpage can let people and machines know about the feed with code like the following.

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

Often people want to advertise the RSS feed in the other places too. (For example, from blog article.) You can do this with code like 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 other can subscribe to their blog from any page on their blog (and not just 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" is this case is wrong. It should be rel="home". (See Understanding rel and rev for more info 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 powerfull; it is mostly hidden. To advertise the RSS feed in a more direct way, the HTML <a> element can be used. Doing this mimics the <link> elements discussed above.

When linking from the the HTML webpage where the data in an RSS feed is also made available use:

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

When linking from something like a blog post article, use code like the following.

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

Again note that these to pieces of code look almost exactly the same. 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.)

Feed Icons

RSS (and other) feeds use a special icon. It is recommended that you use this icon too 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 are available too. Also, source files are available.)

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 of what an HTTP client prefers to receive. This technique takes advantage of that 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

Really though, with production software, 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 to 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


{{template.PreviousNext("RSS:Getting Started:How RSS Works", "RSS:Getting Started:Blogs")}}

{{ wiki.languages( { "pl": "pl/RSS/Na_pocz\u0105tek/Syndykacja" } ) }}

Revision Source

<p>
This page explains Web Syndication with RSS.  You will learn how to make it so both people and machines can find your RSS feed.
</p>
<h3 name="What_is_Syndication"> What is Syndication </h3>
<p><strong>Syndication</strong> (or <strong>Web Syndication</strong>) 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 a Internet television show,  you are syndicating.
</p><p>RSS helps you syndicate.  RSS organizes your syndication into a form that is easy for machines to understand.
</p><p>Syndicating with RSS means 3 things.
</p>
<ol><li> Creating an RSS feed.
</li><li> Adding a special <code><a href="en/HTML/Element/link">&lt;link&gt;</a></code> element to HTML page(s).
</li><li> Adding a special <code><a href="en/HTML/Element/a">&lt;a&gt;</a></code> element to HTML page(s).
</li></ol>
<p>We've already discussed #1 -- creating RSS feeds -- so we'll focus on #2 and #3 here.
</p>
<h3 name="Adding_the_.3Clink.3E"> Adding the &lt;link&gt; </h3>
<p>Often the data in an RSS feed is also made available on an HTML web page.  When this is the case, the HTML webpage can let people and machines know about the feed with code like the following.
</p>
<code><pre>&lt;link rel="alternate" type="application/rss+xml" href="http://example.com/feed" /&gt;
</pre></code>
<p>Often people want to advertise the RSS feed in the other places too.  (For example, from blog article.)  You can do this with code like the following.
</p>
<code><pre>&lt;link rel="home" type="application/rss+xml" href="http://example.com/feed" /&gt;
</pre></code>
<p>Note that this looks almost exactly like the previous code.  The only thing that has changed is the value of the <code>rel</code> attribute.  (The previous code had a <code>rel</code> value of <code>alternate</code>.  And this code has a <code>rel</code> value of <code>home</code>.)
</p>
<div class="note">
<p><b>NOTE</b>: There has been some abuse with usage of the <code>&lt;link&gt;</code> element for RSS syndication.  Some bloggers want to make it so other can <em>subscribe</em> to their blog from any page on their blog (and not just their <em>home page</em>).  This has caused many to add a <code>&lt;link&gt;</code> with <code>rel="alternate"</code> everywhere.  (On the entries of the blog too, and not just the <em>home page</em>.)  This is wrong!  Using <code>rel="alternate"</code> is this case is wrong.  It should be <code>rel="home"</code>.  (See <a href="en/Understanding_rel_and_rev">Understanding rel and rev</a> for more info on this.)  The important part when using <code>&lt;link&gt;</code> for syndicating your RSS feed is to put in the <code>type="application/rss+xml"</code>.
</p>
</div>
<h3 name="Adding_the_.3Ca.3E"> Adding the &lt;a&gt; </h3>
<p>While use of the HTML <code>&lt;link&gt;</code> element is powerfull; it is mostly <em>hidden</em>.  To advertise the RSS feed in a more direct way, the HTML <code>&lt;a&gt;</code> element can be used.  Doing this mimics the <code>&lt;link&gt;</code> elements discussed above.
</p><p>When linking from the the HTML webpage where the data in an RSS feed is also made available use:
</p>
<code><pre>&lt;a rel="alternate" type="application/rss+xml" href="http://example.com/feed"&gt;...&lt;/a&gt;
</pre></code>
<p>When linking from something like a blog post article, use code like the following.
</p>
<code><pre>&lt;a rel="home" type="application/rss+xml" href="http://example.com/feed"&gt;...&lt;/a&gt;
</pre></code>
<p>Again note that these to pieces of code look almost exactly the same.  The only thing that has changed is the value of the <code>rel</code> attribute.  (The previous code had a <code>rel</code> value of <code>alternate</code>.  And this code has a <code>rel</code> value of <code>home</code>.)
</p>
<h3 name="Feed_Icons"> Feed Icons </h3>
<p>RSS (and other) feeds use a special icon.  It is recommended that you use this icon too when creating the special <code>&lt;a&gt;</code> link to your feed.  The icon looks like the following: 
</p>
<dl><dd><img alt="Image:Feed-icon-32x32.png" src="File:en/Media_Gallery/Feed-icon-32x32.png">
</dd></dl>
<p>You can get more icons like this from <a class="external" href="http://feedicons.com/">Feed Icons</a>.  (Other sizes and colors are available too.  Also, source files are available.)
</p>
<h3 name="Advanced_Syndication_Techniques"> Advanced Syndication Techniques </h3>
<p>Although this advanced technique for syndication is not required, support of this is recommended; especially for web sites and applications with high performance needs.
</p><p>The <a href="en/HTTP">HTTP</a> protocol -- one of the core technologies behind the web -- provides a way of prioritizing the content type of what an HTTP client prefers to receive.  This technique takes advantage of that by having the client <em>prefer</em> RSS (over HTML or other formats).  Here's a simple example of it being done.
</p>
<code><pre>Accept: application/rss+xml, text/html
</pre></code>
<p>Really though, with production software, it would look more like this.
</p>
<code><pre>Accept: application/rss+xml, application/xhtml+xml, text/html
</pre></code>
<p>Here's a more complete example:
</p>
<code><pre>GET / HTTP/1.1
Host: example.com
Accept: application/rss+xml, application/xhtml+xml, text/html
</pre></code>
<p>When an HTTP server (or server side script) gets this, it should redirect to the HTTP client to the feed.  It should do this with an <code>HTTP 302 Found</code>.  Something like:
</p>
<code><pre>HTTP/1.1 302 Found
Location: http://example.com/feed
</pre></code>
<p><br>
</p><p>{{template.PreviousNext("RSS:Getting Started:How RSS Works", "RSS:Getting Started:Blogs")}}
</p>{{ wiki.languages( { "pl": "pl/RSS/Na_pocz\u0105tek/Syndykacja" } ) }}
Revert to this revision