Tumblr may come up with "real" tag browsing soon, but meanwhile, here's a tag cloud that -- unlike third party services -- uses the actual tags that you assign to your posts.
Basically, the script calls the Tumblr JSON API and processes the posts, 50 at a time (the maximum allowable; configurable). It saves the tags, URLs, and a bit of the content. If there are any remaining posts, it keeps on doing this until it retrieves all of them, or reaches a preset maximum (150 by default, or thrice). It then renders the tags in varying font sizes depending on the total number of times each tag was used.
By default, links are created for each of the tags. Clicking on a tag will generate a list of posts with that particular tag. [ Hey Tumblr! A /tags/<tagname> path that only shows posts with that tag would be nice. :-) ]
I used Jason Levitt's Dynamic Script Tag class to call the Tumblr API as many times as required.
Here's*** the quick-and-dirty demo script showing the tags from my scifaiku site (again). If you do use it, please send me your URL via a comment. :-)
*** Update: The original one didn't use the titles (I had no titles in scifAI, originally) but instead parsed the content up to the first HTML tag. Here is a more generic one, using post titles.
Monday, March 10, 2008
Tumblr hack: A real tag cloud
Subscribe to:
Post Comments (Atom)
11 comments:
just put it up on mine. cool!
gregcbrown.net
Hi Greg! You may want to try this one instead, as the original code was tuned for scifAI. The new one uses the actual post titles as the links. See the tumblrCallback function for changes.
Hi Alex, I'm working on putting mine up here: http://www.maiaeats.com
Thanks!
Hey Alex -
First off, thanks so much for putting this together!
Now, on to the business at hand... I'm trying to get this up and running at http://tumble.toddlevy.com/ and it's not quite working.
It'll only return 3 or 4 posts at most. I tried messing with CLOUD_JSON_NUM and CLOUD_JSON_MAX to no avail.
In fact, as best I can tell, CLOUD_JSON_NUM isn't ever used in the code. And if I set CLOUD_JSON_MAX to 0, I get a 503 error from Tumblr.
Any help appreciated.
TL
Hi
I'm using your tag cloud, too.
And I've the same problem as Todd!
Thanks for any help
Benvenga
Hey thanks for this neat script: i spent a bit of idle time tooling around with it on my page, and created a crappy hack that puts a tag blurb at the bottom of posts as well. Now if there was some way to do it on the dashboard, i feel like a dumba**, but still, it was fun to play around with:
http://modx.tumblr.com/post/43313433/enjoy-the-tags-or-else
Bug Report :-D
Find this line:
cloud_request = new JSONscriptRequest(CLOUD_JSON_URL + '?callback=tumblrCallback&type=regular&start='+cloud_done+'&num='+CLOUD_JSON_MAX);
And change CLOUD_JSON_MAX to CLOUD_JSON_NUM.
Also, the script only shows text posts. If you aren't getting very many results, maybe you don't have very many text posts.
Thanks!
I've updated mine to
1) include all tags from all types of posts (remove "type=regular" from buildCloud function) and,
2) set the tags to be links to the list of your posts with that tag.
' +cloud_tags[i]+ ' ';
Active here:
http://reactorboy.tumblr.com
@joegasper: THANK YOU!
Tag cloud is finally working as desired on my site!
See it in action here...
http://tumble.toddlevy.com
got it (sort of) kind the way I want it.
http://hotwheels.tumblr.com/
thanks.
Just got it all figured out.
http://p4tr1ck.tumblr.com
Post a Comment