Hide Certain Labels from Labels Gadget


Two weeks ago I published one of my best Blogger tweaks yet, how to hide certain posts from Blogger homepage. You get to hide certain posts simply by labeling the post 'hide'. One of the ways to view the hidden posts is by clicking on the 'hide' label, or any other name that you've chosen to trigger the hide sequence. Blog reader 'Gardens Jewish Experience' wants this particular label to be taken off from the Labels gadget as well.

In this tutorial, you will learn how to remove a particular label from the Labels gadget. It is completely independent from last week's tutorial. Therefore, you can always use this tweak to hide certain labels from appearing on your Labels gadget.


Step 1: 

It goes without saying that you have to have the Labels gadget already added before attempting this tweak. If you don't know how to add the Labels gadget, this tutorial probably isn't for you. Next, access your template's HTML.

In default layout:
Go to Dashboard - Design - Edit HTML - Expand Widget Templates.

In new layout: Go to Dashboard - Template - Edit Template HTML - Expand Widget Templates.

Find and delete the following lines then.
<b:if cond='data:display == &quot;list&quot;'>
<ul>
<b:loop values='data:labels' var='label'>
<li>
<b:if cond='data:blog.url == data:label.url'>
<span expr:dir='data:blog.languageDirection'><data:label.name/></span>
<b:else/>
<a expr:dir='data:blog.languageDirection' expr:href='data:label.url'><data:label.name/></a>
</b:if>
<b:if cond='data:showFreqNumbers'>
<span dir='ltr'>(<data:label.count/>)</span>
</b:if>
</li>
</b:loop>
</ul>
<b:else/>
<b:loop values='data:labels' var='label'>
<span expr:class='&quot;label-size label-size-&quot; + data:label.cssSize'>
<b:if cond='data:blog.url == data:label.url'>
<span expr:dir='data:blog.languageDirection'><data:label.name/></span>
<b:else/>
<a expr:dir='data:blog.languageDirection' expr:href='data:label.url'><data:label.name/></a>
</b:if>
<b:if cond='data:showFreqNumbers'>
<span class='label-count' dir='ltr'>(<data:label.count/>)</span>
</b:if>
</span>
</b:loop>
</b:if>
The lines to be deleted (Starting portion):


The lines to be deleted (Ending portion):


Step 2:

Paste the following lines in place of the deleted lines above:
<b:if cond='data:display == &quot;list&quot;'>
<ul>
<b:loop values='data:labels' var='label'>
<b:if cond='data:label.name != &quot;hide&quot;'>
<b:if cond='data:label.name != &quot;ADDITIONALLABEL&quot;'>
<li>
<b:if cond='data:blog.url == data:label.url'>
<span expr:dir='data:blog.languageDirection'><data:label.name/></span>
<b:else/>
<a expr:dir='data:blog.languageDirection' expr:href='data:label.url'><data:label.name/></a>
</b:if>
<b:if cond='data:showFreqNumbers'>
<span dir='ltr'>(<data:label.count/>)</span>
</b:if>
</li>
</b:if>
</b:if>
</b:loop>
</ul>
<b:else/>
<b:loop values='data:labels' var='label'>
<b:if cond='data:label.name != &quot;hide&quot;'>
<b:if cond='data:label.name != &quot;ADDITIONALLABEL&quot;'>
<span expr:class='&quot;label-size label-size-&quot; + data:label.cssSize'>
<b:if cond='data:blog.url == data:label.url'>
<span expr:dir='data:blog.languageDirection'><data:label.name/></span>
<b:else/>
<a expr:dir='data:blog.languageDirection' expr:href='data:label.url'><data:label.name/></a>
</b:if>
<b:if cond='data:showFreqNumbers'>
<span class='label-count' dir='ltr'>(<data:label.count/>)</span>
</b:if>
</span>
</b:if>
</b:if>
</b:loop>
</b:if>
New lines in place (Starting portion):


New lines in place (Ending portion):


That is it. I've included two entry-hiding lines above. That means you can hide up to two labels with the code above. If you want to hide more entries, simply duplicate the lines I've highlighted above. Note: For each label, you need to add two conditional tags (example: Line 4 and 22). And make sure you close both of them (Line 16 and 34).

Another thing. I've been extremely busy for the past few weeks, and I expect to be very busy for the next few weeks as well. I'll be moving to a new house, and I'm not gonna have access to the Internet for a few days. My only hope is to use tethering from my Android device to stay in touch with the cyberspace. After that I'll be attending the Google Top Contributors summit, so I'm not sure if I'll be able to respond to your questions in time. My apologies if it take ages for me to get back to your questions and comments. Cheers and God bless.