examining rss feeds

In bloglines, I notice some subscriptions have either their favicons appear on the subscription link (for example, any blog powered by Blogger), or have a small graphic that appears in the header (for example, wunderground.com’s weather channels). My DR subscription, though, doesn’t show any icons or graphics. This therefore has to be something that’s being sent by the feed.

Feeds come in three basic flavors these days — as I understand it, Atom is the newest kid on the block, the most widely used is probably RSS 2.0, and RSS 1 is still used by a few places but largely deprecated in favor of RSS 2. I found all the usual disagreements over which was the best, which would be most easily extensible in the future and so on and so forth. In the end, though it seems to me that much of the time a site will offer both Atom and RSS2.

Atom and RSS 2 provide a means to package up a site (an HTML page) into an XML representation which can then be used by a feed reader and/or aggregator, to put up the info about the site into the aggregator/feed reader. If you use Bloglines (or Google Reader, or any of a dozen other similar programs out there), that XML is what they’re using to snag info from your subscriptions. These programs will query your subscription sites regularly for any updates and download those into your reader.

To see your own WordPress atom and rss2 feeds, add feed/atom to your WordPress blog address, and just feed for rss2. So for example, DR’s RSS2 feed is at http://www.digitalramble.com/feed and it’s atom feed at http://www.digitalramble.com/feed/atom. Note that to see the atom feed, you’ll have to save it to a file and open it with a text editor (browsers do not “recognize” Atom pages yet.)

In tracking down the feeds for these examples, I found XML descriptors of the format channel->description->image->url and the url’s would be the locations of the images being used. Obviously, my own feed generators are not doing this, because even though I jumped through all the hoops to get favicons up for my site, they’re not showing up in a Bloglines subscription.

I, of course, must fix this.

So WordPress generates two feeds in a basic setup (at least, basic here at DreamHost?). I have three relevant files in my top wordpress directory: wp-atom.php, wp-rss.php, and wp-rss2.php. Because RSS 2’s so popular, let’s look at that one first. There’s a RSS 2 specification here. So as an experiment, I edit the wp-rss2.php file to contain

<image>
<link>http://digitalramble.com/</link>
<url>http://digitalramble/wordpress/favinit.gif</url>
<title>Digital Ramble</title>
</image>

Of course once I get into the php file and look around, I change this to use the same php bloginfo to genericize it:

        <image>
                <link><?php bloginfo_rss('url') ?></link>
                <url><?php echo get_option('siteurl'); ?>/favinit.gif</url>
                <title><?php bloginfo_rss('name'); ?></title>
        </image>

This isn’t perfectly ideal of course. Seems like there should be a favicon per theme, which loads in with the theme, and updates the icon in the browser tabs, bookmarks, and feeds. As it is, I’ve only got one favicon installed, and if I change things around I would have to change the current theme’s header.php, and the wp-content’s atom/rss generators.

Maybe I should make this a plugin, for the experience of creating an addition to the Dashboard, where you can enter your favicon, and then add the appropriate calls in your atom/rss2 feeds and your header…hmmm not a bad idea. Not today though :) This is just proof of concept.

OK, onto Atom. Googling around, I find its specification here. In scanning down this file, I find the relevant item: atom:icon about half way down the text. This looks like it. Here’s what it says:

The “atom:icon” element’s content is an IRI reference [RFC3987] that identifies an image that provides iconic visual identification for a feed.

atomIcon = element atom:icon {
   atomCommonAttributes,
   (atomUri)
}

The image SHOULD have an aspect ratio of one (horizontal) to one (vertical) and SHOULD be suitable for presentation at a small size.

There’s also atom:logo which is almost the same, except for a 2:1 horizontal:vertical aspect ratio. OK, so after some tinkering around, I decide on adding:

<icon><?php echo get_option('siteurl'); ?>/favinit.gif"</icon>

I’m not as certain of this one, because the atom feeds I was able to look at, on sites that have icons showing (such as DistroWatch), don’t seem to contain any icon information in their atom description! I did come across some comments that some aggregator sites will just pull the favicons from the feeding sites (but in that case the favicon.ico I have in my root directory should show up, unless that’s not really the root directory, which could well be the case…)

Now to publish this so I can see the results if any in Bloglines…!

del.icio.us:examining rss feeds  digg:examining rss feeds

Leave a Comment

Bad Behavior has blocked 1096 access attempts in the last 7 days.