Skip to main content

Ralsina.Me — Roberto Alsina's website

Nikola Feature-by-request: tag cloud!

I asked for fea­ture re­quests for Niko­la my stat­ic site gen­er­a­tor. I got some. One was from long-­time us­er Kay Hayen, so I just could­n't say no.

He asked for tag cloud­s. Look:

Any­thing in here will be re­placed on browsers that sup­port the can­vas el­e­ment

Cute, is­n't it? And it's re­al, ac­tu­al tag da­ta from this very site. With links!

How it's done:

Niko­la gen­er­ates a JSON file that has the cloud da­ta (tag name, size, link), and that's pro­cessed by JQuery and tag­Can­vas and ... well, it work­s.

You have to add jquery.tagcanvas.min.js somewhere and embed a whole pile of raw HTML (see here for details) but hey, it works.

Hope you are hap­py, Kay, you made me code javascript, dude ;-)

It's prob­a­bly rather "easy" to make it use any of these in­stead of tag­Can­vas if any­one is so in­clined.

Kay Hayen / 2012-12-28 11:02:

Really, really happy now. The raw HTML, I see from the source, but Nikola master doesn't yet contain the code to create the JSON file, right?

Roberto Alsina / 2012-12-28 12:30:

Looks like I forgot to push it (duh!). I seem to be unable to push it right now on 2G, will try again as soon as connectivity improves a little.

Kay Hayen / 2012-12-28 12:31:

It's ok, take your time.

Roberto Alsina / 2012-12-28 12:35:

Looks like it got through now :-)

昭俊 孟 / 2013-02-24 11:38:

There's error so cloud tag broken:
"Uncaught ReferenceError: jQuery is not defined" in jquery.tagcanvas.min.js

Roberto Alsina / 2013-02-24 14:29:

That usually means the order of loading the .js files is wrong and it's loading tagcanvas before jquery :-(