Feature
Post

Category
Code


Roll Your Own FriendFeed with Movable Type

There’s been a lot of excitement the last few weeks over FriendFeed, the new lifestreaming service that lets you pull together all the different services you publish to into a single feed.

I’ve tried FriendFeed and it works great, but why ask someone else to do something you could do yourself? The combination of Movable Type and the Action Streams plugin make rolling your own lifestream easy.

The Action Streams plugin was created by Six Apart a few months ago. It allows you to pull data from a variety of different web services into your blog. You can use it to create a sidebar — or a separate page — listing your most recent Flickr photos, Digg stories, Twitter updates, and more. Action Streams supports over 50 different sites, and additional sites can be added through plugins.

Getting Started

Screenshot of the Other Profiles pageInstall Action Streams just like any other MT plugin. One extra thing you’ll need to do, if you haven’t done it already, is set up a cron task for MT’s run-periodic-tasks tool. After the plugin is installed, go to your account profile in MT. You’ll find a new link to Other Profiles. On that page, you can add each service that you use, choosing whether or not to include that site’s data in your stream.

At this point, you can either create a new blog that will publish your action stream, or integrate it into your existing blog.

Creating a New Action Streams blog

Screenshot of the blog creation pageThis is the easier of the two options. From the blog drop-down at the top left of any page, choose Create a New Blog, then select the Action Streams template set. Give your new blog a name and choose where to publish it, then click Create.

When your new blog is created, go to the plugin settings, click on the Action Streams plugin, and enable rebuilding of indexes when new actions are found. We do this so your action stream will be updated with any new actions every time the cron job you set up earlier runs.

And that’s all there is to it. Publish to Flickr, Twitter, or wherever else you create content, and your new action stream will always show your latest happenings. It even includes an RSS feed.

Integrating with Your Existing Blog

This method is only slightly more trouble. We’re going to add your action stream to your sidebar. The plugin comes with an example template for creating a sidebar widget, but that code is wrong. Here is a corrected version:

author-action-stream.mtml

Create a new index template, and copy the contents of the file above into the template. Name it Action Stream, and have it output to actionstream.inc. Save and publish this template, then try viewing the page in your browser to make sure it published.

Now, go to your widgets and create a new one. What we want to do here is include your action stream in such a way that it’s always up-to-date on every page it appears on, even if that page hasn’t been republished recently. If you’re publishing dynamically this isn’t an issue, you can just include it like this:

<mt:include file="/actionstream.inc">

But if you’re publishing static files you’ll need to do a type of include that doesn’t involve MT. If you publish your site as .php files, you can do this:

<?php include($_SERVER['DOCUMENT_ROOT'] . '/actionstream.inc'); ?>

Or, if your server supports SSI, you can do this:

<!--#include virtual="/actionstream.inc" -->

Screenshot of the widget sets pageRegardless of which method you choose, name this widget Action Stream and save it. Go to Design -> Widget Sets from your menu, click on Sidebar, and drag the new Action Stream widget into your sidebar widget set. Publish your site, and your Action Stream should be in your sidebar. As with the other option, you’ll need to go to your plugin settings and enable automatic rebuilding for your action stream to stay up-to-date.

If you also want an RSS feed, there’s an example template for that in the plugin, and it is correct.

So there you have it — your own FriendFeed-type feed, on your own site. Granted, FriendFeed does offer more options, but this allows you to keep your readers on your site, and lets you style it any way you want. Be sure to check out the Movable Type Plugins Directory for plugins that add additional services to Action Streams.


  1. By Yves posted on May 13, 2008 at 5:42 am
    Want an avatar? Get a gravatar! • You can link to this comment

    I’ve managed something similar on my MT powered blog:

    http://yvesluther.name/

    Since I wanted to have my blog posts in full length and style I had to take a different approach. In short I tweaked my Atom Feed (to integrate the entryID), then the ActionStreams plugin (to retrieve the entryID) and finally the main index template. The details are described here (though unfortunately in German):

    http://yvesluther.name/web-20/2008-04-25/myfeed/

  2. By BillyMabray posted on May 16, 2008 at 2:25 pm
    Want an avatar? Get a gravatar! • You can link to this comment

    Yves,

    That’s awesome, I’ve been trying to figure out a good way to do that. Your code examples (and a little help from Google Translate) made it easy to follow your post.

    Thanks!

  3. By Alexander Mikhalev posted on May 27, 2008 at 8:07 pm
    Want an avatar? Get a gravatar! • You can link to this comment

    Man, thank you very much for your post. I was banging my had aroun this for three hours.
    Thank you very much. As soon as I will start proper blog I will link your blog.

  4. Trackback