2 minutes
XSLT - Make your RSS feed look like your front page
After stumbling upon this post I decided to give XSLT a go.
A few examples
-
Making my blog’s RSS feed look like my front page: This site’s RSS feed visually mimics its front page.
-
Prettifying the output of my feed generator.
-
Beautiful Podcast Feed with embedded episode player for my youtube to podcast project.
Some notes after playing with XSLT in a few projects:
- Styling your site’s feed to match your site’s appearance is trivial, but probably confusing when a user expects to have clicked on an RSS feed (thus the orange banner on this site’s feed).
- Poor support across browsers:
- Safari appears ignores
Content-type
, doesn’t want to display theXML
at all
- Embedding the
xsl
file into thexml
page is possible, and works on Firefox but not Chrome.
On Firefox this can be achieve easily:
<?xml-stylesheet type="text/xsl" href="#rss-stylesheet"?>
<rss>
...
<xsl:stylesheet id="rss-stylesheet">
...
</xsl:stylesheet>
</rss>
But on Chrome it will only show a white page. Some background on why here.
- Firefox does not support
disable-output-escaping
This flag should prevent escaping of <>
characters, allowing HTML
from the feed’s content to be rendered. Firefox does not seem to be supporting, contrary to Chrome.
Note that if disable-output-escaping
is off
, <script>
tags won’t get escaped either and Chrome will execute their content!
Links and References
- [0] - Style your RSS feed
- [1] - Wikipedia - XSLT
- [2] - RSS Banquet - A Modular Atom/RSS Feed Generator
- [3] - Ydl-Podcast - A simple tool to generate Podcast like RSS feeds from youtube (or other youtube-dl supported services) channels, using youtube-dl
- [4] - This blog’s RSS Feed
- [5] - This blog’s RSS Feed’s XSLT template/stylesheet (which you will note is an XML file and could be, itself, styled…)