Blogger Hacks, Categories, Tips & Tricks

Friday, October 28, 2005
Marc has cracked the Sidebar Menu!!!
Marc Morales Dot Com: "In the end, it works similarly to the category list on Greg's AFL Spectator site. I saved the text above into a file called 'speccy.js' (I kept the name because Greg rulz).... In the body of the blogger template, I call the function list_side_tags() to execute the function, which takes the del.icio.us data and builds the category list. The links in the category list pass arguments to my category.asp page the same way the category links in the posts do."

Spec_freakin_tacular!! So now the whole thing is integrated in-blog!! Categories, and a sidebar menu, all without leaving the site. This is a significant milestone for the system. Great work Marc!!!

Filed In: , ,
Posted at 5:19 PM by John.
6 Comments:
<    >
Blogger Marc said...
Thanks John,

Now just watch blogger introduce a categories feature tomorrow and render all of this obsolete!

<    >
Blogger John said...
Hasn't happened yet, Marc, & I've been at this since the Spring!!

<    >
Blogger Greg said...
I've been inspired by Marc's "in-blog" categories method to upgrade my approach - thanks for the suggestions!

First, have a look at the flat list implementation over at The AFL Speccy. Looks the same, right? Well, if you click on a category (in the side list or in the post), it lists all the posts you've tagged with that tag in the sidebar.

Other changes:

1) I've updated to JSON - no more scraping the delicious pages with wget/grep.

2) It's easier to implement - just put this in your template head:

%script type="text/javascript">
del_user = "thetan";
anchor = "footy";
%/script>

%script type="text/javascript" src="http://ghill.customer.netspace.net.au/tags/flat_list.js">
%/script>

(with your own delicious username and anchor tag!)

Then, put this where you want the listing to occur (eg sidebar):

%script type="text/javascript">
list_side_tags();
%/script>

(NB: all % should be < above - can't post it properly in comments!)

The implementation method is pretty crazy - the javascript writes out some other javascript to fetch the JSON tag object from delicious, and then uses that to fetch the appropriate post JSON post object.

I'm not a coder, so if any gun javascripters want to look at the code and let me know about making it safer/more robust, I'd appreciate that. I've tested it in IE6 and FireFox without errors.

Other subtleties:

* If you click again on an "expanded" category/tag, it will take you to the delicious page - it has some nice features (related tags, clouds, other people's tags etc)

* My post-titles in delicious have the blog name in front of them - the tidy function removes this by dropping all text before the first semi-colon.

* If you click on a post title, the "expanded" tag is persistent (ie carried through in the URL) so that it will be "expanded" at the new page too.

I'll be implementing this for the drop-down list (like at Vent) in the next couple of days.

Lastly, some open questions for the forum:

* Should the drop-down list display posts in a drop down list as well (ie some categories have dozens of posts in them - too long, really)?

* Should the in-post tags take you to the homepage instead of staying on the current page (like at present)?

* Should you be able to select multiple tags? Ie "politics" and "sex"? If so, should this list posts that are tagged with politics AND sex, or posts that are tagged with politics OR sex?

Cheers,

-Greg.

<    >
Blogger Johan Sundström said...
Greg, you wouldn't perchance have a tech blog too sitting somewhere I didn't find it, scouring your site? (With ever growing inspiration and appreciation for your information management work, I might add. :-) A mere comment doesn't quite do these improvements any justice; I was just about to run my own JSON version, after having read about Marc's troubles, when I found yours, and then caught on to your inspired interaction (and visual design) model(s -- you seem to put the system to good use in several blogs).

The nice thing about standing on the shoulders of giants is that you can luxorously focus on taking the next step in some direction rather than doing all the initial ground work; I'm toying with tossing in some fancy live modification of the page for folding and unfolding categories, unless I run into a rubble of trouble fetching Del.icio.us JSON code, and spawning off my code when it has finished loaded, rather than doing it all on pageload time as you do (which is arguably probably the more robust approach -- though I like the occasional challenge).

<    >
Blogger Greg said...
Glad to help, Johan. But I blush ...

That's some damn spiffy javascript you've got happening on your site. I look forward to seeing some inspired folding/unfolding of tags soon (heirarchical menus? Clouds?).

You can see in action an alternative use of the code.

As for a tech blog ... well, I guess I have four (in various throes of decay) so maybe I could start one more?

Cheers,

-Greg.

<    >
Blogger Johan Sundström said...
You definitely should, Greg; you're an excellent designer and technical writer, beside your other skills, and it would help communication a lot. :-)

I'm trying to sum up this thread in a big blog post, to get some overview on it and much for reasons such as not having found this comment until now. It's a bit of a challenge coming up with good ways of cross blog communication commentary, but staying mainline and only writing high profile commentary in feeds covered by RSS is a good start. Don't feel obligued to keep any regularity or high content flow in a blog tech blog, just in case you do create one; being able to participate more easily in exchanges like these is plenty reason enough to maintain one.


eXTReMe Tracker