How to add tag cloud on blogger

This tutorial is for you guys that want to display tags for your categories or labels
Carefully follow the steps below and
you will sucessfully add it on your blog..

» Login to your blogger dashboard
» Select Theme
» Click Edit HTML
» Inside the html box, search for this code
<b:widget id=’Label1′ locked=’false’ title=’Tags’ type=’Label’/>

Some template may look different so search for type=’Label’.


» Now highlight the full code and replace it with the below code


<pre>/*<br />Distributed by John Smith at WidgetsForFree.blogspot.com<br />*/ <b:widget id=’Label1′ locked=’false’ title=’Tags’ type=’Label’><br /><b:includable id=’main’><br /><b:if cond=’data:title’><br /><h2><data:title/></h2><br /></b:if><br /><div class=’widget-content’ style=’text-align: justify;’><br /><script type=’text/javascript’><br />/*<br />Simple Blogger Tag Cloud Widget<br />by Raymond May Jr.<br />http://www.compender.com<br />Released to the Public Domain<br />*/<br /><br />//Settings / Variables<br />var max = 150; //max css size (in percent)<br />var min = 70; //min css size (in percent)<br />var showCount = false;  // show counts? true for yes, false for no<br />var minCount = 1;  // what is the minimum count for a tag to be shown? 1 for all<br /><br /><br />//Begin code:<br />var range = max – min;<br /><br />//Build label Array<br />var labels = new Array();<br /><b:loop values=’data:labels’ var=’label’><br />labels.push(&quot;<data:label.name/>&quot;);<br /></b:loop><br /><br />//URLs<br />var urls = new Array();<br /><b:loop values=’data:labels’ var=’label’><br />urls.push(&quot;<data:label.url/>&quot;);<br /></b:loop><br /><br />//Counts<br />var counts = new Array();<br /><b:loop values=’data:labels’ var=’label’><br />counts.push(&quot;<data:label.count/>&quot;);<br /></b:loop><br /><br />//Number sort funtion (high to low)<br />function sortNumber(a, b)<br />{<br />return b – a;<br />}<br /><br />//Make an independant copy of counts for sorting<br />var sorted = counts.slice();<br /><br />//Find the largest tag count<br />var most = sorted.sort(sortNumber)[0];<br /><br />//Begin HTML output<br />for (x in labels)<br />{<br />if(x != &quot;peek&quot; &amp;&amp; x != &quot;forEach&quot; &amp;&amp; counts[x] >= minCount)<br />{<br />//Calculate textSize<br />var textSize = min + Math.floor((counts[x]/most) * range);<br />//Show counts?<br />if(showCount)<br />{<br />var count = &quot;(&quot; + counts[x] + &quot;)&quot;;<br />}else{<br />var count = &quot;&quot;;<br />}<br />//Output<br />document.write(&quot;<span style=’font-size:&quot; + textSize + &quot;%’><a href=’&quot; + urls[x] + &quot;’ style=’text-decoration:none;’>&quot; + labels[x] + count + &quot;</a></span> &quot; );<br />}<br />}<br /></script><br /><br/><br /><span style=”font-size:80%;float:right;”>Powered by <a href=”http://www.widgetsforfree.blogspot.com”>Blogger Widgets</a></span><br /></div><br /></b:includable><br /></b:widget></pre><br />
<p>


Note: you must delete the old <b:widget id=’Label1′ locked=’false’ title=’Tags’ type=’Label’/> code.

Post a Comment

 
Top