RSS Best Practices

Although we have discussed many best practices at the element level in the last chapter, there are several general considerations and limitations you should keep in mind when building an RSS feed.

Cascading Style Sheets in RSS

If you want fine-tuned control over the formatting of HTML in your RSS feed, it would seem to be a natural fit to use Cascading Style Sheets (CSS). CSS is widely regarded across the web as the formatting mechanism of choice for HTML. (See http://www.w3schools.com/css/ for more information.)

The good news is that you can put CSS in your feed's HTML. The bad news is that many online feed readers (like Bloglines or NewsGator Online) will strip it out. The online readers do this because CSS can pose security risks or disrupt their own styles and layouts. Thus, unfortunately, much of the formatting work you do may not be viewed by your readers.

For this reason, it is generally a good idea to make your RSS content conform to a simple layout that can still look okay if the CSS is removed. For web designers, this will feel like a step backward (and it is), but it is unfortunately necessary. This means you shouldn't rely on CSS for text columns, font formatting, or image placement. Wherever you can, use basic HTML markup for formatting instead.

JavaScript in RSS

There are many wonderful uses of JavaScript on the web today, used for everything from simple form validation to AJAX techniques. JavaScript on your own web site is perfectly appropriate and typically ...

Get How to Build an RSS 2.0 Feed 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.