I get a lot of emails asking me about the giant tag cloud hanging out at the top of my site. So many, in fact, that I thought it’d be a great idea to make a post out of it, as a bit of a mini-tutorial. So, without further ado, here’s how to get an awesome tag cloud in the New Blogger (formerly Blogger Beta).
(UPDATE 24/08/2007: Obviously there’s no tag cloud up there anymore, since I redesigned the site. I’ve posted a screenshot below of what it used to look like. Click it for a larger version.)
Okay, back to the regularly scheduled tutorial.
First start a new blog in Blogger. Got one? Cool.
Now, navigate in Blogger to Template > Page Elements (clicking Layout from the Dashboard will get you there, too). You’re looking for the screen that says “Add and Arrange Page Elements.” Now, in the sidebar of this representation of your blog, click “Add a Page Element.” You’ll get a nice pop-up with a ton of options. Click Labels, cause that’s what you want to add, after all. Keep it alphabetical, change the name if you feel like it, and click “Save Changes.”
Save your template.
Now click over to “Edit HTML.” Definitely a good idea to “Download Full Template” here, to be safe, before you start editing the code. I’ll wait.
Backed up? Good. Moving on.
Search through your code for a line that looks exactly like this:
<b:widget id='Label1' locked='false' title='Labels' type='Label'/>The “title” attribute might be different if you changed it in the step above. Otherwise, this is the line you’re looking for.Copy all of this code below.
<b:widget id='Label1' locked='false' title='Labels' type='Label'>
<b:includable id='main'>
<div class='widget-content'>
<div id='LabelDisplay'>
</div>
</div>
<script language='javascript' type='text/javascript'>
function zoomStyle() {
var max = 0;
var min = 10000;
<b:loop values='data:labels' var='label'>
if (<data:label.count/> > max)
max = <data:label.count/>;
if (<data:label.count/> < min)
min = <data:label.count/>;
</b:loop>
var display = "";
<b:loop values='data:labels' var='label'>
var delta = <data:label.count/> - min;
var size = 80 + (delta * 100) / (max - min);
display = display + "<span style='font-size:" + size + "%'><a expr:href='data:label.url + "?max-results=100"' style='text-decoration:none;'><data:label.name/></a></span> ";
</b:loop>
obj = document.getElementById('LabelDisplay');
obj.innerHTML = display;
}
zoomStyle();
</script>
<b:include name='quickedit'/>
</b:includable>
</b:widget>
And paste it over (on top of, instead of, replacing!) the line you found. Be very careful not to overwrite the </b:section> that will most likely follow it in your template code.Click preview, and if you’ve done everything properly, you’ll have a sweet tag cloud with links of various sizes based on frequency of occurrence (if your blog is brand new, you’ll need to post in it first to see the code at work).
If you don’t want it in your sidebar, go back to the Page Elements page, and move the widget around to wherever you like (different templates set different limits on this, which can be subverted, but that’s beyond the scope of this tutorial - email me if you want to get hardcore).
Enjoy! Get tagging! Post your results in the comments for all to see!
(Note: The code up there is a modified version of the Multi-style labels widget written up on Hackosphere. Credit where it’s due.)


115 comments:
Merci beaucoup!
of course, the new blog hasn't been posted enough for it to look as cool as yours yet, but many, many thanks for your super instructional tutorial!
you're so helpful. of course, i've already exhausted you with this issue.
also: i don't know how you put that html thing in there, but that's awesome. you should do a blog post on how you did that.
Glad I could share the love!
And Ben, great idea about the html formatting. I'll keep that in mind for the future.
Thanks for sharing Kevin.
I've already got my TagCloud but tags appear all in the same 'size'....any advice?
@absinta:
Is it possible you haven't used any of the tags twice?
If you'd like, you can email me your URL and I can take a quick look to see if something sticks out (kevin@frivolousmotion.com).
super thanks for this! =)
got anything on adding del.icio.us 'save this page' to wordpress...? having the hardest time and the FAQ and forums don't seem to be any help...
boo.
or maybe it's just me. or maybe it's wordpress?
Hi,
Is this the same hack :
http://blog-dr.blogspot.com/2007/06/tag-cloud-for-blogger-layout.html
@vin:
Thanks for pointing that site out - as far as I can tell it's the same code, yups - and they link back to this site, ever so subtly, in the final line of the post.
Sweet! Check me out; it's exactly what I wanted! Muchas gracias!
jp - glad to help! What's your site?
Thanks for the code, Kevin. This worked great for me!
Hi Kevin, I tried, but got this message:
We were unable to preview your template
Please correct the error below and submit your template again.
More than one widget was found with id: Label1. Widget IDs should be unique.
I wondered whether I should have replaced the line of code.
I'm a bit of a novice at all of this. :)
Ann, yes, you should have replaced the first line of code (the one that begins b:widget id=label1 locked=false...etc).
You'll notice the first line in the code to copy is exactly the same - either way, you can only have this line ONE TIME.
Hope this helps!
Ta. Thx. Only question now is if I want to give my could a title, where do I put that?
If you want a title for your cloud, stick this code right after <b:includable id='main'> :
<b:if cond='data:title != ""'>
<h2 class='title'><data:title/></h2>
</b:if>
Fantastic. This tag cloud works like a charm. Thanks
Any suggestions or hints on formatting? It worked great in a sidebox, but up top (see http://geekinreallife.blogspot.com/ ) it's looking less fabulous.
Your tag cloud is totally awesome, haha. It's exactly what I was looking for. I played around with my layouts limits and finally got it to show (and correctly) where I wanted it to.
Thanks sooo much!
Thanks for the Awesome Tag Cloud!
Thanks for the tutorial... but I'd like to incorporate a Cloud Widget in my e-commerce homepage that will show the most popular keywords used in the site's search engine. Is this possible?
Does anybody have experience about this?
Any help will be highly appreciated!
You can email me at: arielaharoni(at)electromundo.com
Thanks a lot. I love my new label cloud and will feed it to grow beautifully :)
i love it. but i have far too many freaking labels. Is there any way to cut them off?
thanks, Kevin.
Hi, thanks for the code! I set it up on my blog and I love it.
http://magneticmary.blogspot.com/
Just one thing. For some reason (I'm using IE...) I can't see any image, just a tiny space and a horizontal scroll bar, under "Search through your code for a line that looks exactly like this:" in your post. I managed to find where to paste the code by reading through the comments though.
Awesome, thanks again.
Me again, regarding the image. Seems to be an IE problem (I know, I know... surprise!). The height of the window is too small, you can actually scroll inside and see the line, but badly.
Magnetic Mary: thanks for letting me know about that issue in IE. Glad you were able to figure it out anyway, though!
Hey thanks heaps for the tutorial on tag cloud! You don't know how long I've been searching for this!!
I am the developer of www.MakeCloud.com, a new site that simplifies the process of creating a cloud and adding it to a blog or anywhere else. Just give it an RSS feed and it makes the cloud instantly, with no signup required.
http://www.makecloud.com
It works with blogger too.
I used the one from makecloud.com, I tried yours too but I finally squared to makecould.com :)
thanks for this. got it to work just fine. i'd like to limit the returns - i sometimes use tags for humor or something new - but they may be used just once.
any way to limit the returns to either, 1.) display no more than XX tags, or 2.) display tags with only more than X uses ... ?
thanks
Hi Kevin, I tried to install the code a few times but I keep getting this message:
"Your template could not be parsed as it is not well-formed. Please make sure all XML elements are closed properly.
XML error message: The element type "b:section" must be terminated by the matching end-tag ""."
There was no "/b:section" tag below the script to begin with, so I tried putting one in and then it asks for "div" endtag. Help!
Thanks for this.
This is awesome! I've become rather attached to tag clouds and wanted one for my blog. Thanks for this. You made my day!
The font is a bit small, but other than that I love it. I used it here:
http://blog.zeneece.com/
Oh, and the tutorial was very easy to follow. Thanks for that too! :)
it is too good.. can we increase font size?
on my blog its shows too small fonts is Label Cloud.
Thanks
गीतों की महफिल
Thats an awesome bit of code. Really easy to implement and looks great. The instructions for what to copy over seem to have gone a bit awry in your post as you only see a scroll bar, but it was easy enough to figure out you meant copy over the 'Label1' widget line. In my case I created a second tag list called Label2 and changed the title in your code before pasting it over. That way I get both a cloud and a list. See it in action at http://urbansurvivalproject.blogspot.com/
Thanks again
Rizwan
Thanks a lot! Simply beautiful!
But... I have a question... How you can justify the text in the tag cloud? Just like in your example from http://bp3.blogger.com/_nYL8yRi-mHs/Rs7msgYZbqI/AAAAAAAABFI/Y4AOASn0ELQ/s1600-h/tags.gif ?
Thanks a lot!
I couldn't say 100% for certain because it depends on the rest of the code in your template, but it ought to work to add this bit of code where the other CSS styles are in your template:
#LabelDisplay {
text-align:justify;
}
Hope this helps.
Thank you, man!
It did help me!
hi! thanks to your post i was able to add a sweet tag cloud to my blog. although i have a couple of observations, if you don't mind. i removed the existing "Label" widget code and replaced it with the new one. i changed the title beforehand, so that might be the cause of that. nwei, thanks a bunch man.
Great!
You should add information, that someone should check "expand widget code" in template html edit window, and thet change the code of the widget which generates labels. But when You do that, it works pretty well!
example: http://fiksacie.blogspot.com/
Thanks a lot!
Love it!Thanks!
thanx man!
hey thanks a lots!!
first of all i love Barack Obama
about this great widget its really working
thanks for sharing
Wow! It's good I found your site. I have been experimenting with a number of suggested ways on "how to add Tag Clouds to your Blog." Your instructions were precise and the easiest to follow.
Thank you very much.
Thanks so much! Excellent tutorial that works really well.
Now I have to go check out the other cool things in your blog...
Thanks again! http://theinkgypsy.blogspot.com/
Kevin,
Just wanted to drop you a line and say that I stumbled across your blog when trying to figure out how to do a dynamic cloud tag, and your post couldn't have been more helpful or precise. With your instructions and help throughout the comments, I had it working on the first attempt!
My blog is fairly new and though I originally went with Wordpress.com, I switched over to Blogger within a week. Not being able to do code changes like this one on Wordpress was one of the many things that I hated about the WP platform. When I wrote the post, titledThe Top 5 Reasons I Left Wordpress for Blogger, I mentioned you and your blog, and dropped you a couple links.
FrivMo is in my Google Reader and I look forward to your new posts, so I have also added you to my Blogroll of "Blogs I read often" - keep up the good work!
Thanks heaps!! That was great :)
I've been trying to work out how to get that tag cloud :)
Thank you so much, Kevin!!!
I just add my voice to the chorus: yours are the easiest to follow and really helpful instructions I've found. I love my new tag cloud, replacing that horrible, very long list of labels!
Excellent! Clear, correct instructions! Thank you so much. Now for my one question. How can I enlarge the font? The smallest tags are just too small. Thanks! :)
Sorry - re-commenting just so I can check the box to be notified of follow-up comments. :)
Third comment is a charm - I figured out how to enlarge font. Thanks for your wonderful site. I think I will create a category for listing good how-to sites - and you will be on the list, for sure! :)
Very nice and easy to use i just change my label to cloud tag using this on my blog. Thanks man.
http://xphunt3r.blogspot.com
Perfect. Your instructions are the easiest I've found. Thanks so much!
is there anyway of creating a tag cloud for blogger without having to use labels?
awesome. thanks
That's awesome, thanks so much!
--
The Hacker Chick Blog
Thank you very much, this is fabulous, it's easy and perfect, exactly as i wanted it to be.
Unfortunately i got the problem when i was trying to put tag cloud to my another blogger blog, everything looks ok, but my tags appear all in the same, small size, i used tags more than once, but they still all are the same size, any advise, please?
thank you :)
Thanks it help me so much..
Awesome! This will be a great addition to my blog:
http://icethetics.blogspot.com/
Thanks so much!
So easy! thank you for that :)
Is it possible to have 5 different colours for the labels in the cloud?
Might want to mention (I didn't see it anywhere), that quotes in any of your labels will kill the script. Got it working now that I fixed that. Thanks!
Cheers bud, works a charm.
Looks perfect on my blog.
http://dundeeunitedfc.blogspot.com/
Just like as http://technoexperts.blogspot.com/2008/08/new-blogger-tag-cloud-widget.html.
Thanks a lot pal! I've been trying to get the cloud stuff to work for months but never got to make it... until now!
Just two questions:
1) How can i reduce the amount of tags displayed? I tried reducing the var max to 100, but in the preview nothing changed.
2) Any way that the text color can be changed without changing the link color format in the blog colors section?
Thanks! Come and visit my blog (if you understand spanish, haha) http://wordsknight.blogspot.com
waaaa.. thank you very much for your code :D
Now there's a tag on my blogspot
regards,
aels
Please refer to http://websitewealth.blogspot.com/2008/08/new-blogger-tag-cloud-widget.html as Previous blog has been removed.
Visit http://websitewealth.blogspot.com/2008/08/new-blogger-tag-cloud-widget.html
Guh! Thank you. This was the easiest bit of tweaking I have yet to find for Blogger! Your instructions and additional code offered in response to comments was perfect.
Many thanks!
http://morecruft.blogspot.com
Very nice!
Thank you.
hi! thanks so much. I already upped my tag cloud. Looks much better :)
Thanks Kevin for creating and sharing--the cloud looks nice!
David
I tried over and over but I kept getting this:
We were unable to preview your template
Please correct the error below, and submit your template again.
Your template could not be parsed as it is not well-formed. Please make sure all XML elements are closed properly.
XML error message: The element type "b:section" must be terminated by the matching end-tag "".
credible, thank you! ;)
Thanks! Just what I've been looking for.
http://whoaitsaimz.blogspot.com
Very cool. And way to go creating a post that lives this long!
Put it at the top of the blog, which helps drive home the name of my blog:
www.BigWordzProject.com.
thanks!!
PERFECT! tried several others - pain and did not work! Yours is easy & quick! GROOVEY!
Just solved this problem that was reported above:
If this error message comes up:
++++++++
We were unable to preview your template
Please correct the error below, and submit your template again.
Your template could not be parsed as it is not well-formed. Please make sure all XML elements are closed properly.
XML error message: The element type "b:section" must be terminated by the matching end-tag "".
+++++++
It's because you are doing it in Firefox. Try editing your Blogger blog in Internet Explorer, and it works just fine :-)
See my blog for an example...
It works great... thanks a lot!!!
Books Freak
I added a cloud tag on http://damienlearnsperl.blogspot.com/ thanks to your excellent post.
I had a little trouble for adding the title because there are several lines in the html template exactly like this one:
includable id='main'
and I had picked the first one at first.
After finding the correct one, adding the code that you mentioned in the comments section, the title finally appeared!
Thanks for sharing.
You're my hero.
http://messierobject45.blogspot.com/
Thank you so very much for sharing this info. I've changed mine, and it's wonderful!
Thank you. It is a nice cloud.
http://www.petersrin-events.blogspot.com
Question. Any way to limit the size of the cloud? What do you think?
Thanks a bunch! Love it!
Very, very nice! Thanks!
3 x simpler than phydeaux3's: http://phy3blog.googlepages.com/Beta-Blogger-Label-Cloud.html. And that doesn't even work!
Two comments:
1) In my case the only widget ID I had was 'Label2'. I just changed this in the code, and it ran nearly perfect.
2) No 'Title' was shown. Then I copyed this mini-phrase from the original hackosphere-code, and put it the right place: (h2)Label cloud(/h2), and all was perfect. Including support for our three Danish special characters. Very nice indeed!
A long time ago Clyde asked:
"Any way to limit the returns to either, 1.) display no more than XX tags, or 2.) display tags with only more than X uses ... ?"
Would be fine, if you have a solution for that?
http://herskind.blogspot.com/
Hi great post. exactly what i was looking for. I pasted the code, clicked preview, (did not click `save` anytime),but I got the message `We were unable to preview your template.Please correct the error below, and submit your template again.More than one widget was found with id: Label1. Widget IDs should be unique`. So any tips on trouble-shooting this? Thanks a ton.
Hey Harold, try replacing Label1 with Label2 in the code I provided.
Hi Kevin, Thanks. done
Thanks a lot, cool one i just put it in my blog:)
Thanls a lot, i just put it in my blog:)
This is the simplest way I have ever found to add a fantastic label cloud! I have been looking for this ..for so long! I love the label cloud on my blog page now.
Thanks a ton!
:)
By the way, is there a problem if I have replaced the earlier one line code with this?? I don't want the the old label list anyway (though I know how to get it back now). It's ok..right?
Thanks, I'd been looking for something like that for a long time.
Thank you. Thank you. Thank you!
Just added this to our blog. It looks great. Thank you so much!!!
Awesome. This is the best Blogger tag cloud I found anywhere. I wish I would have started with Wordpress, but thankfully there are people like you that make this stuff and put it out there for others to use. Your generosity is appreciated.
AWESOME! I've been looking for this from yesterday, you're the best! Thank you for sharing this! :"D
Kevin,
Thanks a ton for this beautiful piece of code - you saved me a lot of work. You can the cloud in action in my blog. Thanks again.
Very nice, thanks! I just started blogging at Blogspot, but my tag cloud is already showing my interests beautifully.
thanks! it works great.
I added a tip on how to add a title to the cloud here
Thanks for this, really cool tip!
After this, I also searched for a way to add the tag cloud on top of the page.
Found it here:
http://bguide.blogspot.com/2009/01/howto-add-more-gadgets.html?showComment=1242115500000#c1640390893833455079
Thanks for this - great looking cloud.
One question - how can I change the rollover colour? At the moment it's the same colour all the time which makes it difficult to see which tag words are connected.
Have a look here:
http://themintybadger.blogspot.com
Yours is the only one i've found that actually works without too much mucking about..!!! Thank you so much.. !!
http://whiskygreentea.blogspot.com/
thanks a BILLION. been looking for a blogspot-friendly tagcloud code forever. Thanks so much. It was very easy/user friendly. See it here:
http://star-season.blogspot.com/
Personally I do not think they are that bad. Find the files you are looking for at search-ebook.com the most comprehensive source for free-to-try files downloads on the Web
this what I'm looking for! Thank's a lot!
Thanks a lot for this simple but awesome post. Thanks :)
THANK YOU SO MUCH!!! been stumbling on useless tutorials for tag clouds..urs worked like a charm!! only, still figuring out how to get the title to appear.. thanks again!! keep coming up with tutorials!!
Thank you very much for the instruction. Do you know if I can use the code also with non-blogger templates?
Thanks! It worked for me.
Gracias por compartir!!! realmente funcionó para mi!!
Gracias!!
>>wonderful trick...works like charm...i ve implemented dem on all my blogs...thank u loads
thanks a lot. :)
i had to replace the said line by ur code, but it works. however, it doesn't look like yours. it seems to be in order of frequency rather than in alphabetical order. the visual output is a bit odd. i must have done something wrong!
Hi this is a great cloud, I put it up at http://www.distressedvolatility.com. Is there any way to limit the amount of labels or have > 3 labels to show? Thanks
Oh, sweet. That is bloody brilliant. Cheers, mate.
Post a Comment