Update : This tutorial is no longer compatible, please read the latest tutorial, click here!
In order to make a label cloud, I will use the technique of phydeaux. Before reading and applying this tutorial, make sure that you have added label element in your blog. Before doing this one, make sure that your blog uses a Label. Ok my friends, here are the steps;
- Sign in into blogger
- Click Layout menu
- Click Edit HTML tab
- Click Download Full Template, and then save the data to back up if you make mistakes in editing the template code.
- Click Expand Widget Templates to give a check.
- Wait the process for a few second
- Save the following code between <b:skin><![CDATA[ and
]]></b:skin> or if you are still confused, just save the code right above ]]></b:skin>. - Copy and Paste the following code after ]]></b:skin> and before </head> or if you are still confused, just save right above </head>.
- Find the following code in your template
<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'>
<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>
(<data:label.count/>)
</li>
</b:loop>
</ul><b:include name='quickedit'/>
</div>
</b:includable>
</b:widget> - Change the code above with the code below.
<b:widget id='Label1' locked='false' title='Label Cloud' type='Label'>
<b:includable id='main'>
<b:if cond='data:title'>
<h2><data:title/></h2>
</b:if>
<div class='widget-content'>
<div id='labelCloud'/>
<script type='text/javascript'>
// Don't change anything past this point --------------
// Cloud function s() ripped from del.icio.us
function s(a,b,i,x){
if(a>b){
var m=(a-b)/Math.log(x),v=a-Math.floor(Math.log(i)*m)
}
else{
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 = "<data:label.name/>";
ts[theName] = <data:label.count/>;
</b:loop>
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] < cloudMin){
continue;
}
for (var i=0;3 > i;i++) {
c[i]=s(minColor[i],maxColor[i],ts[t]-ta,tz)
}
var fs = s(minFontSize,maxFontSize,ts[t]-ta,tz);
li = document.createElement('li');
li.style.fontSize = fs+'px';
li.style.lineHeight = '1';
a = document.createElement('a');
a.title = ts[t]+' Posts in '+t;
a.style.color = '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';
a.appendChild(document.createTextNode(t));
li.appendChild(a);
li.appendChild(span);
}
else {
a.appendChild(document.createTextNode(t));
li.appendChild(a);
}
ul.appendChild(li);
abnk = document.createTextNode(' ');
ul.appendChild(abnk);
}
lc2.appendChild(ul);
</script>
<noscript>
<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>
(<data:label.count/>)
</li>
</b:loop>
</ul>
</noscript>
<b:include name='quickedit'/>
</div>
</b:includable>
</b:widget>
- Click SAVE TEMPLATES button
- Finish
Good luck my friends.


45 Comments:
coba lihat di blog http://yourlife-bisnisonline.blogspot.com
my site
salam persaHabatan fren2...
I found one issue where the label cloud could not seem to override my Blogger template settings, so it appeared left-aligned with a serif font. To fix this I changed one line from:
#labelCloud .label-cloud {}
to:
#labelCloud .label-cloud {text-align:center;font-family:arial,sans-serif;}
Then everything worked perfectly. Thanks again for this great tutorial!
I am not really into this so can you please help me? In step 9, if you are asking to find that script exactly, it doesn't appear in my html.
I would appreciate if you can reply.
make sure that you have added label widget in your blog. Before doing this one, make sure that your blog uses a Label.
However, like another commenter above I would really like to know how to apply the same rules for link & text colors as the rest of the blog design. That would make this perfect.
I also figured out how to edit the header that sits above the tag cloud.
Look for this text inside brackets:
b:widget id='Label1' locked='false' title='Label Cloud' type='Label'/
Replace words Label Cloud with the words you want as your header. On mine, it's 'What I write about'.
@BarbChamberlain
I have a small issue with this.
May be because my blog design the labels are appearing only one per line and taking a lot of space at the right side bar. Request help from you and would like to know how can i get this labels side by side.
Here is the problem at my blog
http://abapreports.blogspot.com
Waiting for the reply and thank you once again.
how do i make it come out on the left side of my page? look here. www.rockingsheepishly.blogspot.com
Pk-photography
..now i'm just wondering how to change the blue colour, but i guess i can't have it all.. :D
thanks again!
it's possible to have a label cloud and a label drop down list together?
thanks for advance
http://the-sun-rise-in-the-east.blogspot.com/
memanjang hehehe
http://cookingfunfood.blogspot.com
It is really nice.
but now some time ago it is not work on my computer. can u check ?
it is work on your computer ?
http://pharmajobsindia.blogspot.com
Post a Comment
Please comment in English.
Spam Comment will be delete!