DukeLeNoir/jQCloud — Issue #14: nofollow link
Author: strobotta
Created: 2011-11-04 10:04:48+00:00
State: open

Hello,

in my tagcloud I want to habe rel="nofollow" attributes in the link to prevent search engines follow the links (because this would create an endless loop as the links link to each other.

I added an option parameter for the call so that it may look like this:

$(document).ready(function() {
$("#tagcloud").jQCloud(word_list, { randomClasses: 3, nofollow: true });
});

The patch to the jqcloud-0.2.4.js looks as follows:

--- jqcloud-0.2.4.js	2011-11-04 10:53:45.930038575 +0100
+++ /var/www/av/html/js/jqcloud.js	2011-11-04 10:52:15.322212800 +0100
@@ -25,7 +25,8 @@
y: $this.height() / 2.0
},
delayedMode: word_array.length > 50,
- randomClasses: 0
+ randomClasses: 0,
+ nofollow: false
};

// Maintain backward compatibility with old API (pre 0.2.0), where the second argument of jQCloud was a callback function
@@ -93,7 +94,7 @@
// Linearly map the original weight to a discrete scale from 1 to 10
var weight = Math.round((word.weight - word_array[word_array.length - 1].weight)/(word_array[0].weight - word_array[word_array.length - 1].weight) * 9.0) + 1;

- var inner_html = word.url !== undefined ? "" + word.text + "" : word.text;
+ var inner_html = word.url !== undefined ? "" + word.text + "" : word.text;
$this.append("" + inner_html + "");

// Search for the word span only once, and within the context of the container, for better performance

Could this maybe considered in a future release?
Thank you.