Guidelines for designing RSS feeds
RSS is a standardized XML format for designing feeds that are easily consumable by many feed readers. By providing an RSS feed, visitors to your site can subscribe to the feed and easily stay up to date with new posts, even if posts are very infrequent (such as every few months). However, although RSS provides a standardized format for creating feeds, the actual content that is included in the feed is determine by the site operator.
Here is the set of guidelines I follow when designing my RSS feeds:
1. Include all of your articles in the feed
When possible, include all of your articles in the feed instead of limiting the feed to just the most recent articles. The rationale behind this guideline is that by including all of your articles, a new site visitor can subscribe to the feed and quickly get an overview of all of your posts. Furthermore, since all articles are downloaded locally, they can quickly flip through the articles instead of loading potentially hundreds of web pages to read each individual article.
If your RSS starts to get too big, you can try reducing the file size by:
- Configuring your server to send compressed files.
- Many webservers have modules that can compress plaintext files using gzip or other compression algorithms. Compression can significantly reduce the size of plaintext files. My feed (as of writing this article) went from 174 KB before compression to 42 KB after compression.
- Minifying your RSS XML and HTML content.
- XML and HTML are often indented to improve human readability, but can also be minified to reduce file size.
- Have multiple feeds, a smaller feed with less entries and another feed with all entries.
- If file size starts to become a big issue (for example, if your feed is many megabytes in size even after compression and thousands of feed
subscribers pulling frequently) and there are many articles in the feed, then it might be worthwhile to split the feed into 2 separate feeds. For
example, placing one feed at
/rss.xml
that only includes the last 20 posts, and another feed at/rss-all.xml
that includes all posts.
2. Include full articles, not summaries
Include full article contents in the feed, not just summaries. The rationale behind this guideline is that by including the full article content in your a feed, subscribers will have the choice between reading the article in their preferred RSS client or on your website. Some site operators only include article summaries in their feed, making it a frustrating experience as the subscriber will need to constantly flip back and forth between their RSS client and a browser. Also, many RSS clients are optimized for reading feeds, and have a set of keyboard shortcuts for quick navigation. Websites rarely have such facilities.
The main exception to this guideline is feeds to audio/video resources, such as podcast. In those scenarios, the optimal approach is to include a
link to the audio/video file, a summary of the contents of the file, and, when available, a transcript of the audio. Links to the audio/video files
(and when available the transcript) should preferably be included in the
element (in fact, this element was initially designed for linking audio files in RSS feeds).
3. Use full URL paths
Many websites link resources using relative paths, but some RSS clients will have difficulties resolving relative paths in embedded HTML content. Use full URL paths in the feed instead to avoid this issue.
Path | Example |
full (absolute) path | http://example.com/path/to/image.png |
relative path | ./image.png |
4. Don't include any tracking or JavaScript
Tracking in RSS feeds typically comes in 3 forms:
- JavaScript code that collects background data.
- Tracking resources such as tracking pixels.
- Wrapped links (for example, wrapping all 3rd party links around a 1st party redirect so that the feed producer can track links clicked by the subscriber).
As a common courtesy, don't track. Scripts may be useful in some scenarios, but:
- Not all readers support scripts (especially terminal based readers).
- The use case for RSS is on reading, not interactivity.
So use scripts sparingly and cautiously, but generally avoid them if possible.
5. Avoid embedding 3rd party resources
Related to 4, avoid embedding 3rd party resources in your feed. The rationale behind this guideline is that 3rd party resources:
- [o1]May go down, resulting in dead links and an incomplete feed.[/o1] [o1]May compromise subscriber privacy.[/o1]
As an example, some feeds producers embed YouTube videos in their articles and feeds. These videos are hosted on YouTube's servers, and loading one
of these videos potentially compromises subscriber privacy, since some subscribers may not want to use YouTube services. Additionally, YouTube may
remove the video that the feed is linking to, resulting in a dead link. When you can, move and link resources to a 1st party location (in the YouTube
example, you can use a tool like youtube-dl
, download the video, and host it on your own site). If you are unable to host
the resource (for example if bandwidth is limited, as an alternative, provide a link to the 3rd party resource without embedding it so that subscriber
privacy isn't compromised.
6. Test on a multiple RSS clients
It's best to test on multiple clients as:
- There are a few different versions of the RSS spec.
- The RSS 0.9x and RSS 2.0.x specs are both commonly used.
- Clients may use different XML parsers and embedded browsers.
- Some clients may attempt to correct improperly formatted XML and other client may not (the same feed may work on one client but not other clients).
As a rule of thumb, test on 2 graphical clients (such Liferea and Akregator) and 1 terminal client (such as Newsboat). You can find a large list of RSS clients at this Wikipedia page.
7. Check the spec
As one last measure, its always good to check the RSS spec to make sure your feed complies with the spec. Some RSS readers may attempt to correct for errors in your feed or allow proprietary features that don't comply with the spec. You can also check out the guide on feed validation.
Summary
By following these guidelines, subscribers of your RSS feed will generally have a better experience, and you'll be helping promote a more open and frictionless web by allowing subscribers to read your content using the software that they are most comfortable with.