Error :Liquid Exception: comparison of Array with Array failed in page
Opened this issue · 2 comments
When I added example tags.html tag_cloud to my custom aside with tag_cloud plugin, and run "rake generate", it said error:
/Users/daxiawj/Workspace/octopress/plugins/tag_cloud.rb:76:in sort!' /Users/daxiawj/Workspace/octopress/plugins/tag_cloud.rb:76:in
render'
I don't know what's wrong with my files or configurations.
btw, my tag_pages works fine.
It's a math problem in the plugin.
You only have too change:
weighted = count.map do |name, count|
# logarithmic distribution
weight = (Math.log(count) - Math.log(min))/(Math.log(max) - Math.log(min))
[name, weight]
end
to this:
weighted = count.map do |name, count|
# logarithmic distribution
if min == max
weight = 1
else
weight = (Math.log(count) - Math.log(min))/(Math.log(max) - Math.log(min))
end
[name, weight]
end
I hope it works for everybody...
weighted = count.map do |name, count|
# logarithmic distribution
if min == max
weight = 1
else
weight = (Math.log(count) - Math.log(min))/(Math.log(max) - Math.log(min))
end
[name, weight]
end
or
" # Add this check for NaN to close #2
weight = 0 if weight.nan?"
-----------------yeah,, these can remove that exception。。。
if not have a same tag in three(or more ) posts,all tags in main page will have same font size ,either large or small..
but small may be better, so weight = 0 if weight.nan?"
is better. may weight = 0.5 is the best..
I