Friendfeedifying your feeds

Although these tips are designed for feeds used with Friendfeed, the first two aren’t just for that – it’s just that Friendfeed exposes the extra functions in it’s interface. The third tip regarding SUP currently is only really relevant for Friendfeed.

To check how your feed renders in Friendfeed, check out their feed tester. This gives you info about how your feed will look when you import it. Testing here each step of the way will help you to check things are working as you expect. It’s also recommended to import your feed as a Custom type rather than the Blog type as this gives you more control over it’s appearance.

Starting point

We are looking specifically at Atom feeds here, though it’s straightforward to apply this to an RSS feed as well.



	
	A sample Atom feed.
	
	2009-01-11T03:05:36-08:00
	http://www.example.com/
	http://www.example.com/logo.png
 
	
		
		
		http://www.example.com/1/
		2009-01-11T03:05:36-08:00
		
			

Here is some xhtml content.

Mr Example mr@example.com

This feed just describes one post – in real life there would be a loop that pulled the entries from a database to provide the information without having to hand type this.

Add thumbnails (MediaRSS)

Change the second line to

This adds the xml namespace for the MediaRSS information. This spec belongs to Yahoo hence this document being hosted on Yahoo’s servers.

Then anywhere within the entry tags add the following line:

You can also specify a width and height in this line – if you are using full sized images instead of real thumbnails then specifying this will ensure that the thumbnail is used.

If you are retrofitting this to an existing website then you may wish to write a function that automatically finds an image in your post and uses that for the thumbnail. My quick attempt at this looks like this:

function first_img_url ($string) {
	$pattern = '/]+src[\\s=\'"]+([^"\'>\\s]+)/is';

	if(preg_match($pattern,$string,$match)) {
		$thumb = $match[1];
	} else {
		$thumb = "";
	}
	
	return $thumb;
}

This finds the first image tag in your post then uses that as the thumbnail. Otherwise it just returns a blank string.

Add maps using GeoRSS

As well as showing thumbnails, Friendfeed can also show maps. Again, to add this is pretty straightforward.

To start off with, you need to add the name space as before. If you are using both thumbnails and maps, then just add both xmlns attributes. Here I’m just adding the GeoRSS namespace.

	

Once you’ve done that, then within your entry, just add a tag like this:

	12.345 6.789

The two numbers are longitude and latitude in that order.

Enabling almost instant updates on Friendfeed

Friendfeed have developed a system called SUP, or Simple Update Protocol. Adding support for this isn’t particularly hard, and it will result in almost instant updates to Friendfeed. They provide a FAQ for this on the SUP wiki.

To set this up, first of all just make up an id for yourself. This can be anything you like, the hash of an URL or just any old number you like. It doesn’t have to be unique – if it isn’t then your feed will simply be pinged when a different site has changed. This doesn’t really matter, so just don’t worry much about this! This is referred to as the SUPID of your feed.

To SUP enable a feed, you simply need to add a couple of HTTP headers. The following lines demonstrate how to send these headers using PHP.

header ("Content-type: application/atom+xml");
header ("X-SUP-ID: http://friendfeed.com/api/public-sup.json#SUPIDGOESHERE");

That’s it – your feed is now sup enabled!

Conclusion

By simply adding a few extra lines of code you can easily improve the experience of people following you in Friendfeed. Entries with thumbnails seem to get more attention, so this may even help get more conversations started!

One thought on “Friendfeedifying your feeds

  1. Its nice and quite, no people leaving stupid comments or having bullshit discussions.
    its just a good blog to get your latest information in design/art world.
    keep it up

    good deals

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>