As you no doubt know if you're reading this page, the new version of Blogger includes some pretty neat 'label' functionality which allows you to assign keywords or 'labels' on your posts, and then gives you a handy little do-dad on the side nav which lists out all your labels and the number of posts that have that label. When you click on the name of the label in that side nav do-dad, you get a page with all the posts that apply to that label. (BTW..I know they're called 'Widgits', but I'm bitter on this issue and being difficult)
Anywho, the bad news is that this feature is only available if you use Blogger's news 'drag and drop' templates and as a result host your site on blogspot.com. If you have your blog publish to an FTP site (meaning your own domain), you are out of luck. Even though it's completely feasible from a technical perspective (especially for mighty Google), for some reason they have decided to be lame. Read here for their official declaration of lameness.
Now generally I don't do web development anymore. I did it professionally for a long time for companies like Yahoo! HotJobs and JobThread and I've seriously moved on. But my wife is all about her blog, she really wanted this feature, so I was compelled to come up with a hack solution for her. Since I did it and I saw other people looking for this, I figured I'd share, but let me make some BIG disclaimers:
- This is a HACK job. I'm stretching web technology to it's limits to pull this off, and it's not pretty. Any web developer worth their salt will cringe at the inefficency
and heinousness of how this is done.
- It's kinda slow - there is a visible sometimes lengthy delay before the content shows up (see below for more info)
- You can't see how this looks via the template 'Preview' option. It's a security-related thing that can't be avoided.
- It requires some manual work to set up, and a little bit of ongoing work to keep it working. Basically when you add a new tag, you need to go into your Blogger template and add some simple code
- I'm not really supporting this. I work a very full time job, web dev isn't my bag anymore, and it was an effort for me even to do this much. You can ask. I might help. But don't
expect it.
- Numerous aspects of this solution can screw up your blog big time, and that's all on you. Make sure to back up your existing template first.
- This solution is totally not 'scalable', meaning the more labels you add, and the more posts you apply a certain label to, the slower this will get. There's already a visible delay the first time a user loads a page containing this hack. The more you utilize this, the slower it will get. Why? Because for each label the code needs to go out, load an entire web page behind the scenes, scan it, extract the information it needs (specifically the number of posts for that label), and report back and update your main page. That's a lot of work for some simple stuff.
And so.. with all that said, here's how you set this jambo up:
1) Edit your template, and put this code after the <head> tag:
(note this is gigantic, because if the text in here wraps when you copy/paste, it's gonna break stuff)
