6.7. Embedding RSS Feeds on Your Site

Problem

You want to add another web site's content, such as news headlines, to your web site.

Solution

Get the URL of the RSS feed you want to syndicate, and then use one of the many feed parsing tools to reformat the entries in the feed as HTML for display on your site.

Discussion

RSS, which stands for Rich Site Summary or Really Simple Syndication, is a file format that facilitates the sharing and syndication of web site content. RSS files typically contain 10 to 25 entries, each with a headline, short description, and a link to more information about the entry on the parent web site. RSS files are structurally similar to web pages, but use XML tags instead of HTML. The RSS file format is discussed in more detail in Recipe 6.8.

Warning

Always make sure you have the publisher's permission to syndicate their feed on your site. And never pass off someone else's content as your own—lest you be accused of "feed hijacking" or "blog plagiarism."

The number of RSS feeds has grown rapidly during the last couple of years. Nearly every major news operation, blog, and high-traffic specialty site offers its frequently updated content as a feed. RSS feeds are popular because of their potential: they have been anointed as an antidote to spam and heralded as a way to harness the Web's daily deluge of information. Feeds also scale down nicely for display on small-screen mobile devices. And, of course, they provide a new vehicle for driving traffic to the publisher's ...

Get Web Site Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.