Spread the Word

Site Feed



Powered by FeedBlitz

Subscribe with ...

  • Add this blog to my Technorati Favorites!
  • Subscribe in Bloglines
  • Subscribe in NewsGator Online
  • Subscribe in Rojo
  • Add Random 

Bytes (WebLens Blog) to Newsburst from CNET News.com
  • Add to Google
  • Add to My AOL
  • Subscribe in FeedLounge
  • Add to netvibes

Translate This Post

Burn a Feed

Ping the World

Saturday, January 07, 2006

Blogger Template Hacks: Adding Categories

Blogger lacks the ability to organize posts by category, a feature available in many other blog editors. I have written previously about this problem, directing you to the excellent workaround provided by Daniel Chong Jyh Tar. His solution, based on Blogger's search feature, takes just seconds to implement. He even provides a code generator. Just type your category labels into it, generate the code, and paste it into your template.

But wait! It's not quite so simple. Getting a result that functions reliably and does not produce irrelevant results has taken a bit of experimentation. In his blog, Dan suggests inserting a category label (to base the sort on) in the beginning of each blog title. I didn't want to clutter up my postings that way. Consequently, the results obtained were not always a tight match, since Blogger's search engine was just making a match with any occurence of the query word within a post, rather than pulling out posts dedicated to that topic.

I decided to experiment a bit. Knowing that Blogger is owned by Google, I assumed that the search syntax available would be similar. Google supports certain Boolean terms like the OR operator as well as phrase search. Tweaking your query words in this way before you use Dan's gizmo will produce a tighter, more focused result, and ensure that the right posts get caught.

Here's what I ultimately came up with:

Brainstorm a list of words that describe each topic. Include all variables, including different endings and both singular and plural forms. For example, here's what I typed for the Gadgets, Tools, & Fixes category:

gadget gadgets tool tools fix fixes script scripts

Type your list of words into one field in Dan's code generator, separated by the pipe character ( I ), which Google substitutes for the OR operator. In the previous example, the query now becomes:

gadget I gadgets I tool I tools I fix I fixes I script I scripts

Where you need a tighter result, try a phrase (surround multiple words with double quotation marks). For example, I get much better results with "web design" than with web design, which Blogger seems to interpret as either the word web or the word design. Until I made this change, the query was pulling up every post with the word web in it.

You will have to experiment a bit. The code generated looks nasty, but it works. One final tweak: after pasting into Blogger's template, edit the link text (the words displayed between the anchor tags) for brevity and readability. There's no reason to display a long, unwieldy list of words for each category.

Hope you find this helpful. Stay tuned for more template hacks. Even better, subscribe to my feed and get more on this topic automatically.

No comments: