This post originated from an RSS feed registered with Ruby Buzz
by Matthias Georgi.
Original Post: Building a del.ico.us and flickr sidebar in 5 minutes
Feed Title: Matthias Georgi
Feed URL: http://feeds.feedburner.com/matthias-georgi?format=xml
Feed Description: Webdev, Gamedev and Interaction Design.
You need a del.icio.us sidebar which shows recent bookmarks or one of these nice flickr badges? This is really is easy as the Typo weblog already includes an flickr and del.icio.us aggregator. Download the files delicous.rb and flickr.rb and drop them into your rails lib folder.
Now add these two little helpers to your application_helper.rb:
We are now able to fetch the feeds for our desired tags with a simple method call. Next step is to render a list of links for our sidebar. I use Markaby for rendering my Rails views. It is easy to type and has a clean syntax. So for rendering the del.icio.us sidebar, you need something like this:
ul {
delicious(:ruby).items[0,10].each{ |item|
li { a(:href => item.link){ item.title }} }}
This is pretty self-explanatory. We take the first ten items of the del.icio.us feed and for each item we output a list element containing a link to the item.
The view for the flickr badge is similar:
ul {
flickr(:ruby).pics[0,10].each{ |pic|
image_tag pic.square, :size => '48x48'}}
We take the first ten items of the flickr feed and for each item we render an image tag which shows a square thumbnail of the size 48x48.
Congratulations, you have just written a del.icio.us and flickr sidebar in 5 minutes using only 18 lines of code. Now you can spend the rest of the day pimping up your sidebar with all kinds of feeds using one of these plugins of the typo weblog.