Blogger Hacks, Categories, Tips & Tricks

Tuesday, September 27, 2005
Categories Dropdown w/ Numbers?
Greg, who blogs at both Vent & Speccy, has upgraded the category drop-down form with a javascript that adds a post-count for each category, showing the relative importance of each & giving the reader some idea of what they're getting into. He's also using a great footer that shows the number of posts in categories next to each del.icio.us tag. Pretty cool. He promises a how-to soon, (to which I promise to link, if that's any incentive...) but in the meantime suggests a view-source & crib approach. This may be harder than it looks.....

Posted at 6:06 PM by John.
4 Comments:
<    >
Blogger Greg said...
G'day John,

Thanks for the linkage.

Rather than post a complete how-to with all the various shell scripting, html parsing, ftping and whatnot, I thought I'd spare people the pain I've gone through and share something more convenient.

So, if you're interested in helping me trial counts with your delicious tags by simply linking in some javascript in your blog template, just email me at blog_tags (at) greg-hill.id.au with

1) your delicious username
2) your blog's "anchor tag" [*]
3) a nickname for your blog

(eg for me it's "thetan footy speccy")

Then, you just have to add a javascript call into your blog template for either the sidebar (dropdown a la Vent, or flat list a la Speccy) and/or the post footer.

Each day, scripts at my end refresh the listing (automatically picking up any new tags, re-counting and sorting by count).

It's still a bit experimental, but judicious use of noscript tags in your blog mean it's failsafe (check out my examples above).

What do you think?

Cheers,

-Greg.

[*] The "anchor" tag is the tag common to all posts for that particular blog. It's used to stop listing all your delicious tags, when only a subset is relevant.

<    >
Blogger Greg said...
Hi John,

You can see your example here. (I used the delicious username "jrfj44", anchor of "categories" and nick "freshblog".)

This js file is updated daily. You simply link to it in your blog template and manipulate it as you please with your own scripts, or use some that I've prepared. Simple!

BTW - looking for more volunteers to try this out. Shoot me an email at the above address if you're interested.

Cheers,

-Greg.

<    >
Anonymous timb said...
greg & john,
you may or may not be interested in
http://del.icio.us/feeds/json/tags/your-user-name

if you include it as a script, it puts your tags into a javascript object called Delicious.tags. The object contains all tags and counts. you can also sort by frequency:
http://del.icio.us/feeds/json/tags/your-user-name?sort=freq

<    >
Blogger Greg said...
Thanks, timb, I've been following the json thing closely. While I was aware it could pass back an array with posts in it, I didn't know it could also do counts.

Previously, I'd looked at their html feeds, but the requirement to not hit their site every pageview restricted its usefulness (without caching). But I guess this is no longer an issue with the json feeds!

The other hitch was "anchor tags" - having multiple blogs and using del.icio.us to tag non-blog posts, I needed a way to ensure it only returned the set of tags that shared a common tag (for that blog).

After some experimentation, I found that I could replicate that too! Sweet.

my vent blog:
http://del.icio.us/feeds/json/tags/thetan/vent?sort=freq
and my footy blog:
http://del.icio.us/feeds/json/tags/thetan/footy?sort=freq

Seems to work fine - I will migrate to the new technology and, depending on the results, cutover my userbase as well.

Cheers,

-Greg.

Links to this post:

Create a Link


eXTReMe Tracker