I’ve written previously about why title-less feed items exist. In a nutshell, some posts are so short they don’t have titles. Prime example: Tweets.
Sometime soon the Scripting News feed will have title-less items. If you develop feed reading software and want to offer Scripting News links and posts to your readers, your software must be prepared to handle title-less items.
This piece shows how a feed reader can intelligently handle items with and without titles.
For this howto we may need up to four ingredients from a feed item: title, link, description, guid. When displaying the item, we need up to two bits: headline and body. Depending on what’s in the item, the headline might link to something, or just be bare text linking to nothing.
If the item has a title, the headline is the title.
If the item has no title, but has a description, the headline is the first N characters of the description. The value of N is up to you, based on how you lay the items out on a page, or if it’s a river. In this case the body is empty. We’ve already used the description once. This is where a few aggregators repeat the text. There’s no need to do this, it’s unsightly, confusing, and shows lack of care for the reader.
The headline usually links to something. If the item has a link element, the headline links to that. If it has a guid, but no link and the guid is a permalink, the headline links to the guid. If it has no link, no guid, or the guid is not a permalink, then the headline is bare text, it’s not an anchor element.
If the item has no title and no description, it’s not valid RSS — skip it.
An item with a title, link and description.
How Chrome displays my linkblog feed.
A river that’s made up of feeds with a mixture of titled and title-less items.
This is the method I’ve used in all my river software going back to 1999. They have all been able to handle title-less items. However, I wrote this howto from memory, not from code, so there might be omissions, mistakes or typos. Corrections are appreciated.
Disclaimer: This isn’t a standards body convening in the comments here. I just wrote a howto to help people out, not to begin a “process” or to debate. The Scripting News comment guidelines apply. Use your own space for essays, posts, opinions, screeds, memes, rants, etc that don’t fit the guidelines. Thanks!