Jan 2, 2010

Blogger Label Widget

blogger label navigationMany blogs use a top navigation menu of main blog categories. To reflect your blog's focus you would usually create these menus manually and update them from time to time. An alternative is to have the menu automatically generated for you based on the frequency of the post labels (categories). This is what this widget does. You might want to try it out.

This is a simple extension of the blogger label widget. I will show how to install a label navigation menu similar to the one you can see in the screenshot above.

Basic Installation

You can install it by editing the blogger template and pasting the widget code where you want it to appear. If you want it to appear before your posts you would paste it above the following line:
<b:widget id='Blog1' locked='true' title='Blog Posts' type='Blog'/>

Here comes the widget code you would paste into your template:
<b:widget id='Label1' locked='false' title='Browse Topics' type='Label'>
<b:includable id='main'>
<div class='widget-content'>
<p><div id='topmenu'>
<b:loop values='data:labels' var='label'>
<b:if cond='data:label.count&gt;4'>
<span style='white-space:nowrap;'><li><a expr:dir='data:blog.languageDirection' expr:href='data:label.url'</li></span>
<b:include name='quickedit'/>

The red bold number is a threshold for the minimum number of posts that is necessary for inclusion of the label into your menu. In this case only labels with more than 4 posts are listed. You might want to adjust this number to have enough menu items but not too many.

Note that in order to get an efficient navigation you need a clean label system. You might want to read google help for editing labels of multiple posts at once.


There are many ways you can make the menu look better using some style. Here is an example. Paste this code into your template above the </head>:

#topmenu {
#topmenu ul {
padding:10px 10px 0;
#topmenu li {
padding:0 0 0 9px;
#topmenu a {
color: #ffffff;
text-shadow: 1px 1px 1px #000;
border: solid thin #882d13;
-webkit-border-radius: .7em;
-moz-border-radius: .7em;
border-radius: .7em;
-webkit-box-shadow: 2px 2px 3px #999;
box-shadow: 2px 2px 2px #bbb;
background-color: #ce401c;
background-image: -webkit-gradient(linear, left top, left bottom, from(#e9ede8), to(#ce401c),color-stop(0.4, #8c1b0b));
padding:5px 15px 4px 6px;

This brings the links in form of buttons. Credits go to Ethan Marcotte for the centered tabbed navigation and to John Allsopp for the button look,as described in in his article Shiny Happy Buttons.

Enjoy. Please vote this post up if you like it and leave a comment below for questions and suggestions.


  1. Wow thanks for informing this.. I had been trying to search for a tutorial on how to do that ever since I changed my blog to a dot com. I'll try this out soon.. :)

  2. i think this is waht i need after i changed my template. thanks for this.

  3. I like this widget a lot (sorry for the self-promotion ;). It forces you to systematically categorize your posts. From time to time you'll have to adjust the threshold.

    Before, I was using images for the buttons (using background-url in topmenu a property in css). A few days ago before writing the article I changed all buttons from images to browser generated buttons and I think my blog has become much faster since then. Note the caveat that these buttons look different on firefox, opera, safari, and internet explorer.

  4. I think this widget has a lot of potential to become very popular. Using this widget, I would be able to save 5 minutes on each post because I wouldn't have to categorize each post. Those 5 minutes would be a lot better spent promoting my blog or writing new content. I think that I might try out this widget for my blogs.

    PS From EC

  5. Nice article to improve my Blog lay out...

  6. Hello
    This is a nice post.You have described very good about installation of label navigation menu.Thanks for giving that codes of widget.This will be very helpful.

    hoodia gordonii

  7. @Abhiseqa Says: You're welcome. I hope you'll find it useful.

  8. how did you change your blog to a dot com ive been wishing to do that for ages

  9. Well, this looks to be a nice idea, but I must be stupid because I can't get even your 'basic installation' code to work.

    After I paste your code into my blog's HTML I get an error about mis-matched tags.

    You can see the cause of the error in line 8, the line that starts

    span style='white-space:nowrap;'>
    and then has a couple of 'expr' clauses. There is an opening '<a' tag that is never closed, and no sign either of any matching '</a>' tag either.

    Any chance you could post a correction please?

  10. @mccoy54wru: Thanks for trying out my code and for the question. The code I use is a bit more complicated than the own shown here, because I put in custom popup boxes for navigation, and I must have made a sloppy error when shortening the tags for the post.

    Currently I am not able to save changes to the post. The line should read like this:

    <span style='white-space:nowrap;'><li><a expr:dir='data:blog.languageDirection' expr:href='data:label.url'><data:label.name/></a></li></span>

    Please tell me if it works now.

  11. Hi Benjamin,
    Yes the code is now working, I see my tags appearing at the top of the post as a list. Now I just need to change the appearance - aiming for something like you have at the top of this site.

    Thankyou for your assistance

  12. @mccoy54wru: You are welcome. Great that it works now. Do you want something like my tooltips?

  13. @Benjamin,
    Yes, I'd like something like the tag list you have at the top of this page, although looking at the page source, it looks like to me that you've hard coded it, rather than having it auto generated.

  14. @mccoy54wru: For the tag list on top of the page I use the label widget. This means the tags are auto-generated, no hard-coding.

  15. I dont think googlebot index /search/blah on a blogger site though see:

    Dont know if blogger intself generates a sitemap that it could follow instead or not.

  16. cool widget! How would you replace the code for the look of the buttons for actual JPGs uploaded online.

  17. My buttons use css with pictures + the button texts. If you want to use only a picture, just get rid of some of the CSS and put a picture instead.

  18. Thank you for sharing this information. It is very helpful

  19. This doesn't work

  20. This article is novel,
    Authentic Soccer Jerseys
     I really love it. I also have some ideas written in my article, you can have a look if you have the interest. barcelona jerseyWe can also discuss different topics.

  21. The code I use is a bit more complicated than the own shown here, because I put in custom popup boxes for navigation..

  22. If you want to use only a picture, just get rid of some of the CSS and put a picture instead.

  23.  If you want to use only a picture, just get rid of some of the CSS and put a picture instead.

  24. This is a nice post.You have described very good about installation of label navigation menu.

  25. Hi lastingrose. Seems you made it work after all. Looks good. I'd suggest you'd change the button colors a bit, though. 

  26. Good point. As far as I know, if you don't create special pages for each category there's no way around this. I moved the positioning of these non-follow links in order to have them appear later, which is probably better for SEO. 

  27. Thanks for looking up. I have changed the colours of the button as you have suggested. 

    BTW I didn't know you could create background image in css without an image. Many thanks for the lesson.

  28. Now the buttons look great on your site! 

    I really like these CSS buttons. They are fast to load and provide more flexibility than using images. Credit for the ideas with the css goes to http://24ways.org/2008/shiny-happy-buttons

  29. Does your website have a contact page? I'm having trouble locating it but, I'd like to

    send you an email. I've got some creative ideas for your blog you

    might be interested in hearing. Either way, great site and I look forward to seeing it

    expand over time.
    My website > galerieolsen.keogratuit.com

  30. OptiMind Please tell me you can related to midlife brainlessness. If you don’t please just play along with it, so I don’t feel like the only dimwit around. I know I’m biased, OptiMind but I don’t think there’s a single thing I could hang in my new old shed guest room that I wouldn’t love. I think the bright whites and corrugated metal just make everything look wonderful. I wonder if I can talk my husband into a barn remodel now?
    For more ==== >>>>>> http://www.healthcaresups.com/optimind/

  31. I definitely enjoyed what you had to say. Keep going because Cerebrrin you certainly bring a new voice to this subject. Not many people would say what youve said and still make it interesting. Properly, at least Im interested. Cant wait to see additional of this from you.I was researching from the internet for some information since yesterday night and I at long last found what i was looking for. For more ==== >>>>>> http://www.healthcaresups.com/cerebrrin-scam/

  32. Performing cardiovascular exercise and Crevalor aerobic exercise are two fastest ways to construct muscles. Walking, jogging, swimming, exercising using treadmills and rowing machines are some of the commonly suggested cardiovascular and aerobic exercise for building muscles. It makes you more responsive, reduces fatigue, improves blood circulation, boost setting, degrade blood pressure and market weight loss. For more ==== >>>>>> http://www.supplements4help.com/crevalor/

  33. There's no supernatural bleach for boostingTesto Roar your testosterone, but few spontaneous remedies may cater.It doesn't get solon raw than effort a best nighttime's rest.For more ==== >>>>>> http://guidemesupplements.com/is-testo-roar-scam/

  34. The Presuppose Subject syllabus is premised onNeurocell the accumulation that as we get veteran our brains prettify displace businesslike at processing accumulation from the senses (not because of prissy hazard or exteroception end .For more ==== >>>>>> http://www.supplements4help.com/neurocell/

  35. Omalu got the intelligence examined it and constitute CTE.Why these guys Omalu and Bailes wondered. Why not new guys? Not every old NFL participant after all goes gaga and kills himself.For more ==== >>>>>> http://www.supplements4help.com/neurocell/

  36. Intelligent pare tightening tips and methods are Ageless Illusion somebody for exploit rid of change sagging cutis on approach innate remedies and peel tightening tips. For more ==== >>>>>> http://guidemesupplements.com/ageless-illusion/

  37. Champion Pet Toiletry with Shea Butter and Beverage Butter ? For a cervix cream to be powerful in diminishing the appearance of pet wrinkles it gift necessity to be healthy to activity intense wetness to help choose the peel. For more ==== >>>>>> http://guidemesupplements.com/dermafi/

  38. The Wu-Yi tea diet actually gives a person the benefits that can be derived from drinking both green and black tea, Garcinia Health Max although Wu-Yi is better recommended for those who want to lose weight. The taste of the tea can't be faulted either; the distinctive taste and flavorful aroma makes dieting more easy and delightful than it actually is.

  39. This Lytess Slimming Leggings gift aid engagement how these boots shorten your legs. A large shirt or caretaker mini shirt on top testament wheel out the closed body hunging lour half.For more ==== >>>>>> http://slimminggarciniaadvice.com/garcinia-health-max/
    Garcinia Health Max

  40. to make bubble patterns. This is visual intelligence, which is one of the simplest types of intelligence Brainplus IQ science has known. People like the light mental stimulation such games provide, and that is a major reason for their universal popularity. http://guidemesupplements.com/brainplus-iq/

  41. However, if you are one of those people who just want a less stressful game just to ease up and relax for Brainplus IQ some time the best thing that can be done is to download full version games which are available online for free downloads. Even there are also several online games available which offer some good quality gaming experience along with a perfect item as past time. In this. For more ==== >>>>>> http://guidemesupplements.com/brainplus-iq/

  42. This is a really good read for me, Must Millionaire Circle admit that you are one of the best bloggers I ever saw.Thanks for posting this informative article.nice information its usefulness and significance is overwhelming the way you covered all the basic necessary information is really impressive good work keep it up.I am not capable of see this website properly on my cellphone. For more ==== >>>>>> http://shredhdxabout.com/beware-millionaire-circle-scam/

  43. font know whether its my side problem or Derma Breast Liftn your site? some words from the submit on your blog have character encoding problem, yes i use auto detecting, can u pls look into this problem a bit.It's arduous to find knowledgeable folks on this matter, but you sound like you recognize what you're talking about! Thanks.This is my second time reading from this blog.For more ==== >>>>>> http://guidemesupplements.com/derma-breast-lift/

  44. you are actually a just right webmaster. Muscle HD The web site loading speed is amazing. It sort of feels that youre doing any unique trick. Moreover, The contents are masterpiece. you have performed a wonderful job on this matter.i have checked this site a few times now and i have to say that i find it quite exaltation actually. keep it For more ==== >>>>>> http://shredhdxabout.com/muscle-hd/

  45. Hoped that we will lengthen our friendship Elite Test 360 through a mutual hyperlink trade? Let me know, and fine to see you here.I'm not that much of a internet reader to be honest but your sites really nice, keep it up! Ill go ahead and bookmark your site to come back later. Cheeseburger so right. Im there with you. Your blog is surely worth a read if anyone comes throughout it. For more ==== >>>>>> http://guidemesupplements.com/elite-test-360/

  46. By simply including water on the packet, Neu Serum Pro foods fanatics can be able to sit a while and enjoy a new wholesome meal.Daniel, yea I can see what you probably did there. I really favored that part, but hehe I am not that harsh like my dad with these things. He at all times tells me crazy stories back within the day and calls me a loser. I suppose its time I transfer out of my dad and mom basement . For more ==== >>>>>> http://www.healthcaresups.com/neu-serum-pro/