How To Add New Blogger Tag /Label Cloud Widget

Posted by Lasantha Bandara on May 25th, 2009 File Under : background, gadget, widget1 Comment

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

2.Scroll down to where you see this:


3.Now copy below code and paste it before  ]]></b:skin>  tag.

/* Label Cloud Styles
----------------------------------------------- */
#labelCloud {text-align:center;font-family:arial,sans-serif;}
#labelCloud .label-cloud li{display:inline;background-image:none !important;padding:0 5px;margin:0;vertical-align:baseline !important;border:0 !important;}
#labelCloud ul{list-style-type:none;margin:0 auto;padding:0;}
#labelCloud a img{border:0;display:inline;margin:0 0 0 3px;padding:0}
#labelCloud a{text-decoration:none}
#labelCloud a:hover{text-decoration:underline}
#labelCloud li a{}
#labelCloud .label-cloud {}
#labelCloud .label-count {padding-left:0.2em;font-size:9px;color:#000}
#labelCloud .label-cloud li:before{content:"" !important}

4.Now copy below code and paste it between  ]]></b:skin>  and  </head>  tags.

<script type='text/javascript'>
// Label Cloud User Variables
var cloudMin = 1;
var maxFontSize = 20;
var maxColor = [0,0,255];
var minFontSize = 10;
var minColor = [0,0,0];
var lcShowCount = false;

5.Now again Scroll down to where you see this:

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

Note : Your label widget ID(Label1)  can be different.In my case label widget ID is 1.

Example:-If your label widget ID is x , above code is;

<b:widget id='Labelx' locked='false' title='Label Cloud' type='Label'>

Now replace  <b:widget id='Label1' locked='false' title='Label Cloud' type='Label'>  with below code.

<b:widget id='Label1' locked='false' title='Label Cloud' type='Label'>
<b:includable id='main'>
  <b:if cond='data:title'>

  <div class='widget-content'>
  <div id='labelCloud'/>
<script type='text/javascript'>

// Don't change anything past this point -----------------
// Cloud function s() ripped from
function s(a,b,i,x){
  var m=(a-b)/Math.log(x),v=a-Math.floor(Math.log(i)*m)
  var m=(b-a)/Math.log(x),v=Math.floor(Math.log(i)*m+a)
  return v

var c=[];
var labelCount = new Array();  
var ts = new Object;
<b:loop values='data:labels' var='label'>
var theName = &quot;<>&quot;;
ts[theName] = <data:label.count/>;

for (t in ts){
  if (!labelCount[ts[t]]){
  labelCount[ts[t]] = new Array(ts[t])
var ta=cloudMin-1;
tz = labelCount.length - cloudMin;
lc2 = document.getElementById('labelCloud');
ul = document.createElement('ul');
ul.className = 'label-cloud';
for(var t in ts){
  if(ts[t] &lt; cloudMin){
  for (var i=0;3 &gt; i;i++) {
  var fs = s(minFontSize,maxFontSize,ts[t]-ta,tz);
  li = document.createElement('li'); = fs+'px'; = '1';
  a = document.createElement('a');
  a.title = ts[t]+' Posts in '+t; = 'rgb('+c[0]+','+c[1]+','+c[2]+')';
  a.href = '/search/label/'+encodeURIComponent(t);
  if (lcShowCount){
  span = document.createElement('span');
  span.innerHTML = '('+ts[t]+') ';
  span.className = 'label-count';
  else {
  abnk = document.createTextNode(' ');

  <b:loop values='data:labels' var='label'>
  <b:if cond='data:blog.url == data:label.url'>
  <a expr:href='data:label.url'><></a>
  <b:include name='quickedit'/>


Now save your template and your done.

It will look like this :

File Under : background, gadget, widget

One Response to “How To Add New Blogger Tag /Label Cloud Widget”

  1. cricist says:

    I apply whole method but it can't works please reply me

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.