Blogger Hacks, Categories, Tips & Tricks

Monday, February 13, 2006
New Category Service
Amit e-mailed to tip me off about Labelr, his solution to the absence of categories in blogger. Labelr is in private beta, has a google discussion group, and can be seen in action on Amit's blog, Nerdier than Thou. Looks pretty cool. Labelr has a pre-set list of categories in the sidebar, and a custom-built list of posts within your template when you select a tag, apparently without loading in a pre-dated blogger post. Looks good. I'd be interested to know, Amit, how you add your tags to your posts, and how easy it is to add an additional category? Interesting stuff.....

Of course, for added exposure of your material on tag search sites, state-of-the-art tag-passing and tag-grabbing interactivity, and a sweet "pops open in your sidebar" post title menu, you can't go wrong with the FreshTags.

Update: Have had an invite to the beta of Labelr, so let's check it out. First we have to register, (w/ craftily inserted advertisement!)

"On the top of my wishlist for Blogger was support for categories or labels to organize my posts. Came across this service,, that lets me do that seamlessly. Check it out."

and then, apparently, I have to get into my template a bit and fix a couple of div tags, so that Labelr knows what to label. Will do that tonight....

Filed in: , , , , ,
Posted at 5:55 PM by John.
<    >
Blogger Greg said...
Dman, that is some sweet geeky goodness!

When you select a category from the sidebar, it loads all posts from that category on the main page. We've seen this before, but what makes this special is what it doesn't do.

1) You're not required to have every post ever on the front page (judiciously turning off/on the appropriate posts with display:none is the usual method here).

2) You get the whole post, not just the first 255 characters a la search engine results (typically achieved by stuffing the first para into the delicious notes field).

I had a poke around in Amit's internals:

and it seems to work by setting up two JSON objects, one with the URL and category number of each post, the other with category number, name and description. [NB: Amit seems to have one category per post - not sure if this is a technical restriction or just his blogging style.]

After that, the gist of it is that it builds a request for an external script on Amit's server that takes a blog ID (eg 3), category number (eg 12) and post number (eg 5).

The resulting script is just a wrapper function around a bloody big string containing the HTML of that particular post. This gets written into the appropriate div on the main page and voila - dynamic, asynchronous display of posts on the main page!

This surprises me - my guess was that he was grabbing the RSS/atom feed for the blog and crunching that on the client side somehow. But, on reflection, you couldn't guarantee the length of history that way.

I'm not really sure what's happening on the server side eg how all that content gets filed appropriately on Amit's server - perhaps he'll enlighten us?

In terms of John's question about category management, I imagine new ones get edited into the JSON object, either manually or via some server side scripts?

Given the JSON-y nature of these "data" and "all_labels" objects, I'm sure that it would take comparatively little effort to get delicious to provide these instead as a JSON feed. This would allow people to, in effect, use delicious as their category manager ie add, remove, split, rename, search, syndicate as RSS, browse, share, promote etc their categories. Oh - and get category counts!

(This would also have the side effect of letting people use FreshTags to format and display categories and post titles in their sidebar.)

OTOH, Amit may wish to re-purpose those FreshTags functions to work with his code - it's all Creative Commons stuff after all!

Anyway, the upshot is that this is one awesome hack. And I hope Amit will join us to flesh out what happens on the server side ...



<    >
Blogger Amit said...
Hi John,

Its trivial to add or remove cteagories to your blog, or to apply/remove them from individual posts. A post can have multiple categories/labels. You can checkout how I manage them by going to admin view of my blog.

Greg: 5 in is not "post number", its the page number.

On the server I store the content of the post, when you apply tags/labels to them for the first time, and you can imagine the rest.

<    >
Anonymous Craffter said...
My god, brilliant this is it... true blogger oh man... now we can have 2 kind of categories if wanted, and if we just add a category counter, we can have the numbers of post displayed on them.. tags, listing categories, true categories...awesome stuff.

<    >
Blogger Greg said...
Hi Amit,

That admin view is beautiful!

Just on the server side stuff, is it push or pull? I mean, do you have a script wake up and scrape your customers' blogs, or do they manually "post" it to your server by invoking some kind of script?

Also, what do you reckon about the JSON/delicious/technorati integration? It's a natural fit with your web2.0 tech. Happy to collaborate with you on that one.



<    >
Blogger Aditya said...
mind boggling stuff!

blogger could literally buy off his method! (once its out of beta phase) because it looks fantastic, and works even better!

well done amit! :)

<    >
Blogger Amit said...
crafter: thanks, all you asked are already in plans.

greg: can we please move this discussion to labelr-users. would be easier for me to follow the replies.

aditya: i do not know about buying business, its cool and all, and i would like it to be free if enough donations came in to support hosting/bandwidth.

and thanks everybody for lavish compliments :-)

<    >
Anonymous Craffter said...
Amit: well, i was not directly asking, i just was realizing the inmense potential and without a doubt effect this will have in the blogger scene.

I will ask for a beta when i have finished with my blog, wich will very soon, i will combine it with other pretty cool featureslike dynamic loading with ajax/ahah and a aflax style switcher..this year is my year with last.

but thanks for your atention, and for developing this..i didn´t checked but you accept paypal donations right?

<    >
Anonymous Craffter said...
GREG: yeah, web 2.0 blogger blogs at last.

<    >
Anonymous Craffter said...

Well, that is the thing, blogger already has all the capabilities for categories, they only have to release blogger categories tags, and categories will be sorted out right out the archives without a problem, the only categories factor they would have to add is to decide if they do it as sections categories, meaning they will let you add your categories but without tags sharing the same post right in the blogger system.

or supporting tags and let you add a relative category that is indexed by tags and called that way.

Or even then , they could support both. i bet that it will be the first one and that the categories will be controled. meaning you can only add 10-15 categories if you want to use blogger supplied categories. or you could use Amit´s Labelr service and have almost as many as you want i guess..and after amit just really opened the gates, i can see other triying to follow suit.

But i am all about supporting the rogue coder at the lead, so lets cheer Amit and support his method all the way with this..


<    >
Anonymous Craffter said...
Amit: while writing to adyta i wondered about other things: there is a limit about how many categories can be added?. how about Categories atom(or rss) feeds? that would be the killer app for your service. i was having that curiosity....i know i am thinking too forward,too fast, but hey i can´t help it.. =P

<    >
It's already got RSS 2.0 feeds for categories hasn't it?

<    >
Yep...It does...It's wicked!

Luvly Jubbly


<    >
Blogger Greg said...
I think this project makes for a great labour of love and is appealing for people on the cutting edge of blogging. In terms of Google/Blogger purchasing or otherwise adopting this tech and scaling it "in the large", I think they may take the view that storing everyone's blog posts as html and rss is already enough, and publishing them as JSON feeds (or near-analog) too might be a stretch.

But hey - what do I know? Disk is cheap and getting cheaper and ditto for bandwidth.

For those following at home, here is the FreshTags thread on Labelr's discussion group:

FreshTags for Labelr

Amit has put this on the backburner but he's promised to look into this later. I hope that there's a fruitful cross-fertilisation of ideas, code and users in the near future. "Social" Labelr with flexible presentation would have very wide appeal!

Links to this post:

Create a Link

eXTReMe Tracker