How To Hide/Show (Expand/Collapse:+/-) Labels of blogger blog

Posted by Lasantha Bandara File Under : change template, html, labels 4 Comments

1.Log in to your dashboard--> layout- -> Edit HTML

2.Without expanding your widgets,Scroll down to where you see this:-

<b:widget id='Label1' locked='false' title='Labels' type='Label'/>

3.Replace above line with below code:

<b:widget id='Label2' locked='false' title='Labels and Feeds' type='Label'>
<b:includable id='main'>
<script type='text/javascript'>
//<![CDATA[
if(typeof(rnd) == 'undefined') var rnd = '';
rnd = Math.floor(Math.random()*1000);
rnd = 'id-' + rnd;
document.write('<a href="#" onclick="tmp = document.getElementById(&quot;' + rnd + '&quot;); tmp.style.display = (tmp.style.display == &quot;none&quot;) ? &quot;block&quot; : &quot;none&quot;; return false;" style="float:left;margin-right:5px;">');
//]]>
</script>[+/-]
<script type='text/javascript'>
//<![CDATA[
document.write('<\/a>');
//]]>
</script>
<b:if cond='data:title'>
<h2><data:title/></h2>
</b:if>
<div class='widget-content'>
<script type='text/javascript'>
//<![CDATA[
document.write('<div id="' + rnd + '" style="display:none;">');
//]]>
</script>

<ul>
<b:loop values='data:labels' var='label'>
<li>


<b:if cond='data:blog.url == data:label.url'>
<data:label.name/>
<b:else/>
<a expr:href='data:label.url'><data:label.name/></a>
</b:if>
</li>
</b:loop>
</ul>

<script type='text/javascript'>
//<![CDATA[
document.write('<\/div>');
//]]>
</script>
<b:include name='quickedit'/>
</div>
</b:includable>
</b:widget>

4.Click on Save Templates(or Confirm and save) and Refresh your site.

4 thoughts on “How To Hide/Show (Expand/Collapse:+/-) Labels of blogger blog

  1. Hello, I am on New blogger and I am trying to get this code to work. Infact, I have tried about 5 different code setups, but no go. Do you think you could check out my page, and tell me what you think? I am trying to list my labels in columns across the page widget.

    http://orthodoxeyes.blogspot.com

    Thanks, Matt

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.