Sunday, 11 December 2005

Feeds: how to enable autodiscovery for both full and partial feeds

In my previous post on how to offer your readers more than one type of feed to subscribe to as they choose (full, excerpts or headlines only), I said I'd explain for those who don't know how to implement autodiscovery for their feeds, and I also mentioned using just one of your multiple feeds for autodiscovery.

For those who don't know, this post will cover how to insert code in your blog template to enable autodiscovery - which is a way to enable your visitors' feed readers etc. to automatically pick up your feed URL from your blog URL (if you use Feedburner the feed URL will be quite different from your Blogspot or other blog provider's feed URL). And it's actually quite easy to enable autodiscovery for all your different types of feeds.

Most blogging platforms will automatically include in your template the autodiscovery code for the standard feed that's associated with your blog. But that just won't be good enough if you've:
  • customised your template heavily (e.g. by deleting the <$BlogMetaData$> tag in Blogger, which can cause all sorts of problems)
  • burned a Feedburner feed (see my previous post on why you'd want to, and how to do it), or
  • want to enable autodiscovery for several feeds, where you've implemented the option for your readers to subscribe for longer or shorter feeds.
You'll have to edit your template yourself, in that case. But it's pretty straightforward. Here's how:

1. Note down your feed URL (or URLs, if like me you've decided to offer multiple feeds to your subscribers). If you're using Feedburner make sure you've enabled SmartFeed (see my previous post).

2. In your blog template, insert the following code between the <head> and </head> tag (but before the <$BlogMetaData$> tag if you're on Blogger - it seems to work even if you leave that tag in, but it may confuse subscribers as the standard Blogger feed URL will be displayed there too, even though it'll be last on the list, so consider deleting that tag - but watch out for the associated problems if you do). Then save the changes and republish your blog.

Of course you should first change, and to the URLs of your full, excerpts and headlines feed respectively (if you only offer one or two types of feed just delete the line for the feed you don't need), and also change "A Consuming Experience" after the "title=" to the name of your own blog, in each case, in your own template.

The "title" bit (e.g. title="A Consuming Experience (full feed)") is the description for the feed which your visitors will see in their feed reader, so the "title" in each line of the code is slightly different to match the different type of feed. Change "A Consuming Experience (full feed)" etc further if you like, but obviously it's most helpful to your readers if you make the description, well, descriptive - not "My feed" etc).

Here's the code:
<link rel="alternate" type="application/rss+xml" title="A Consuming Experience (full feed)" href="" />
<link rel="alternate" type="application/rss+xml" title="A Consuming Experience (excerpts feed)" href="" />
<link rel="alternate" type="application/rss+xml" title="A Consuming Experience (headlines only feed)" href="" />
and this is what it looks like when someone clicks the Live Bookmark icon at the end of the address bar in Firefox 1.5:

3. Some gotchas and hints:
  • include the code for the different feed options one after the other as above, with no other code like script tags in between them (some feed readers may not pick up the later URLs if there is other code between)
  • not all feed readers will show the "title" of the feed (e.g. Feed Demon doesn't, it just shows the feed URLs), so it's best to make the URLs of your burned feeds descriptive to help your readers (like with "Full" at the end of the URL in the case of my full feed)
  • put the line for the feed you want to be your "default" feed at the top, for readers and other things which don't recognise different options and just pick up the first one in your template (I'd suggest putting the line for the full feed first because the full feed is best for the search engines etc, see my previous post). It'll also help if you're on Blogger and decided to leave in the <$BlogMetaData$> tag (you can even change the "title=" for the first line to add something like "Pick this feed if in doubt", if you wish! Though it will obviously lengthen the title).

[Added later] Note: I don't know enough yet about how the search engines etc. which pick up and use your feed from your blog work. I believe and hope they'll just pick up the first feed URL in your template/page, so I've added all three options to my template - but there's no guarantee they won't choke instead if they find more than one.

So if it's more important for you that the search engines pick up your full feed (I've outlined the importance of that in my previous post) than that feed readers show more than one autodiscovery option, it may be safest to just include ONE autodiscovery line, for your full feed. (Obviously for those search engines where you can manually submit your feed URL that's not a problem, just submit the full feed URL - it's the ones which autodiscover your feed that I'm not sure about.)

If anyone knows for sure how the search engines work on this front, I'd be interested to hear from you.

Technorati Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , ,


freddie said...

Thanks for this detailed post... I'll give it a try!

Improbulus said...

Thanks for your comment Freddie.

Only thing is, the procedure & code are different for New Blogger. Looks like your blog is still on old Blogger so that's fine for now, but you may need to tweak things when your blog gets moved over.

Keep an eye on my blog (you can subscribe to my feed if you wish) as I'll be posting a howto on that.