Ubuntu / Linux news and application reviews.


blogger drop-down labelsIf you use blogger (blogspot.com) and have a lot of labels, then you really need to display your labels in a drop-down menu. This option is not default in Blogger, but easily achievable.

To customize your labels widget in Blogger to be displayed as a drop-down menu
:

1. First, make a backup just in case. To do so, go to your Blogger Dashboard, Layout > Edit HTML > Download Full Template

2. Go to Layout > Edit HTML in your Blogger dashboard. This time, do not check the "Expand Widget Templates" checkbox!
3. Search for the following code (it doesn't have to be exactly like this, for my blog for instance, Label1 is called Label12):
<b:widget id='Label1' locked='false' title='Labels' type='Label'>


4. Replace the above code, with this:

<b:widget id='Label1' locked='false' title='Labels' type='Label'>
<b:includable id='main'>
<b:if cond='data:title'>
<h2><data:title/></h2>
</b:if>
<div class='widget-content'>
<br/>

<select onchange='location=this.options[this.selectedIndex].value;' style='width:200px'>
<option>Labels</option>
<b:loop values='data:labels' var='label'>
<option expr:value='data:label.url'><data:label.name/>
</option>
</b:loop>
</select>

<b:include name='quickedit'/>
</div>
</b:includable>
</b:widget>



In order for this to work, you have to have a label widget in place. And you have to have posts labeled. So, go to your dashboard | layout | page elements | add a gadget | Labels before trying this code.

If you want the label count, after this: (in the above code):
<option expr:value='data:label.url'><data:label.name/>

, add this:
(<data:label.count/>)


After that, all you need to do is save your template.