Thursday, May 11, 2006

Latest Buzz

Lately I've been working on some stuff that I think is pretty cool. At Newsgator we're calling it Buzzlets, which is kind of a lame name (originally it was NewsBytes, but then it turned out the New York Times has that trademarked).

Basically Buzzlets are little blocks of data that can be easily dropped onto a page. They pull from the Newsgator database to show things like "Most Buzzy" or "Most Popular" posts. Mostly just what's going on in the world. It's neat data, updated regularly.

I was going to put them up here, but I just haven't had the time. Putting together the Buzzlets themselves is not hard, but making it pretty is tough for a code geek like me. So instead, check them out on the Newsweek reader. It's the stuff in the left side bar, under the heading Latest Buzz.

But that's from a user perspective. What's neat from a geek perspective is that getting the data just takes one SCRIPT tag. On top of that, is fully templatable from inside your HTML. Basically you write an invisible tag that has the template inside it, tell the SCRIPT tag about it, and it takes care of the rest.

The templating engine is about 11KB of pure Javascript that downloads itself, grabs the data, reads your template, smashes the two together and sticks the result into your page. I have to say I'm pretty proud of it. It's not the first (or even best) Javascript templating engine out there. For example, I considered using TrimPath JST, but decided it wasn't quite right. It has a lot of capabilities we don't need that added complexity, and was missing a few things I really wanted.

You can also nest them inside each other -- originally the Newsweek reader used that and some slick DHTML effects from my coworker. So for each thing you see in the Latest Buzz now, it would accordion out to show more in depth info like the feed's image, number of subscribers, description, and list of recent posts. I really liked it, but it didn't quite make the cut for this version. We're hoping it'll get in the next version.

No comments: