The logical structure of the page (including "widgets" like archives, feeds etc) seem to be encoded in a strange markup and dumped in a giant string in the header. This string is the sole parameter of a function called "_WidgetManager._Init". This function is invoked on page load and is defined in this external script. At this point, my brain boggled and I needed a lie down.
The actual
To that end, I knocked together a little fragment of (ugly, unsafe) code to extract the labels and counts into a JavaScript object and read it back to you:
javascript: var rexp=/search\?label=(\S+)/i; var cexp=/.*(\d).*/i; var labels={}; var links=document.links; for(var i=0; i<links.length;i++) if (l=rexp.exec(links[i].href)) if (!links[i].rel) labels[l[1]]=cexp.exec(links[i].nextSibling.nodeValue)[1]; for (var j in labels) alert(j+' ['+ labels[j]+']')
(load up a beta blog and copy/paste this code into your browser address bar to watch the magic unfold.)
Here's another code snippet to transform Google's labels into a form a little more familiar to delicious JSON feed users:
javascript: var rexp=/search\?label=(\S+)/i; var cexp=/.*(\d).*/i; var labels={}; var links=document.links; for(var i=0; i<links.length;i++) if (l=rexp.exec(links[i].href)) if (!links[i].rel) labels[l[1]]=cexp.exec(links[i].nextSibling.nodeValue)[1]; var str="if(typeof(Delicious) == 'undefined') Delicious = {}; Delicious.tags = {"; for (var j in labels) str+='"'+j+'":'+labels[j]+','; str+="};"; document.write(str);
Does that get your creative juices flowing?
Filed in: blogtech, blogger, freshtags, blogger-hacks, del.icio.us beta
See also:
http://code.google.com/apis/gdata/blogger.html
There's some reading on how Atom deals with categories (or labels), and how to suck them out of Google.
At least there's hope for delicious/Blogger integrating to the point that it should be possible to batch load tags/labels out of delicious and into Blogger ...
... or should that be the other way around?
At the moment, delicious has superior tag management facilities - which speaks poorly of Blogger given my difficulties last week.
Where is the natural home for your blog's tags? With your blogging platform or your tagging platform?
So, Pete, any chance of JSON(P) feeds? It sure makes life easier for Blogger extension-enthusiasts.
From a UI point of view the sidebar should display interestingly lookin links. This expandable archive stuff takes extra clicks and it doesn't show those attractive topics peeps wana read.
It's such exotic code I have no idea what it does jet. lol Maybe it can be disabled. We shal probably end up making it even more complex. ha-ha
Never the less, it's big fun. :-)
Good luck beta.blogger hackin.
Maybe do both? But it would get crazy very quickly.
One reason might be that you could do a practical "show all posts with these labels" switcheroo.
Well, if you're fully tagged up in delicious, go and get FreshTags and put this link under the posts section:
<a href="javascript: window.location.href = 'http://' + window.location.host + '/search?label=' + curr_tags">See these posts!</a>
That way, readers can use FreshTags to browse your tags and look at post titles. If they want to see the actual posts (not just titles) they click this button. Those posts are displayed in their entirety on the page. Best of both worlds!
Of course, until the Atom label and post feeds are JSON-friendly, this supposes that Blogger labels are kept synced with the delicious/technorati ones ... time for a Greasemonkey update?