A tag cloud or label cloud for blogger is a list of all the labels used within a blogger blog displayed with style.You can see a demo of the Label cloud widget here on my site. This Tag Cloud Widget was originally developed by phydeaux3. I have just simplified and made it easier to install..
You can see a good implementation of this label cloud widget on one of our readers blog -Speak Media Blog.
First Of all Goto Your blogger Layout>Page Elements page and add a Labels Widget there..You can Do that using the Add a Page Element Option on that page.
Blogger Hacks- How To Put Widgets Label Cloud Or Widgets Tag Cloud On Blogger Sidebar
Choose to sort the labels Alphabetically when prompted.
After Adding the Label Widget Goto Layout>Edit Html (Do not expand the widget templates for the sake of easy explanation)
You will find some code similar to
<b:widget id='Label1' locked='false' title='Labels' type='Label'/>
Add Code New
<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'/>
<p align='center'>
<script type='text/javascript'>
var cloudMin = 1;
var maxFontSize = 25;
var maxColor = [0,255,0];
var minFontSize = 10;
var minColor = [0,0,0];
var lcShowCount = false;
// 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';
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>
</p>
<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>
Now find
]]></b:skin>
Add CSS Label Cloud Widgets for Blogger
#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}
]]></b:skin>
Save your template and now you should get a working Label Cloud On your Blog.
How to Add Label Cloud Widget For Blogger
Thank u very much. Please tell me how to add this post a comment box in blogger like the one you have.
ReplyDeleteThank u very much
ReplyDeleteLovely! Was about to try and write this myself and thought... hrm... there must be some clever bugger who has done this. That person happened to be you :)
ReplyDeleteThanks a lot man! been searching for this hack
ReplyDeleteThis is awesome, thanks. One question is there a way limit the labels to only show those with a count greater than x (in my case 5)?
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteWOW!!! Bless you...been considering adding this to my blog for a while now, and just remembers tonight that I wanted to add it. Took me 2 mins to find this entry and 7 minutes to add it to our blog on Blogspot, which I've setup as a subdomain of our main domain, via http://blog.axsystechgroup.com. Check it out, it looks great on the site. Thanks again.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDelete@photojunk
ReplyDeleteNO SPAM.
How do I change the color of the text in the label cloud?
ReplyDeleteYes, same question here. How to change the colors of some bigger labels? The color green looks odd for my blog template.
ReplyDeleteThanks for this easy tutorial.
Knock, knock. Please answer our query.
ReplyDeleteThanks for this tutorial. I change max & min color variable in JavaScript code.
ReplyDeleteVery good article for new bloggers.
ReplyDeletewww.techieway.blogspot.com
Hi I have been trying to install this code in my blog my I am not yet successful can you help me with it. www.treasure-net.blogspot.com
ReplyDeleteI have not been able to add the label cloud successfully. Only the heading 'Label Cloud' shows. Must have done somethng wrong I guess. Please advise. www.ileadifollow.blogspot.com
ReplyDeleteSame thing happened to me as Navinder. Only see "label cloud" on my sidebar. :(
ReplyDeletehey u r blog is very nice how can i get this theme plz give me the xml theme plzzzzz thnx
ReplyDeleteThis is awesome. I would love to be able to do this on my blog....but my HTML seems to be different than what you show? That is of the reason that I am getting error..May you help in in getting out of it.
ReplyDeletecomment system
Download Jailbroken Quick tools
ReplyDeleteAwesome post. Thanks for sharing.
ReplyDeleteImprinsic Marketing Group
ChudnutieDieta.sk -
ReplyDeleteAko schudnúť?
Ako pribrať?