{"id":23,"date":"2007-02-22T23:10:28","date_gmt":"2007-02-22T22:10:28","guid":{"rendered":"http:\/\/schuerig.de\/michael\/blog\/index.php\/2007\/02\/22\/tag-cloud\/"},"modified":"2021-11-24T09:20:09","modified_gmt":"2021-11-24T08:20:09","slug":"tag-cloud","status":"publish","type":"post","link":"https:\/\/www.schuerig.de\/michael\/blog\/index.php\/2007\/02\/22\/tag-cloud\/","title":{"rendered":"Return of the Tag Cloud &#8212; ajaxing the tagged"},"content":{"rendered":"<p>On my continuing quest to become more Web-2.0-ish, I&#8217;ve tried my luck tilting at&#8230; well, tag clouds. To get an idea what I&#8217;m talking about, please <a href=\"http:\/\/www.schuerig.de\/michael\/webdesign\/demo\/tagcloud.html\">have a look<\/a>.<\/p>\n<p>These are the rudimentary basics to create a tag cloud like that.<\/p>\n<p>In the controller<\/p>\n<p><code><\/p>\n<pre>\r\ndef tags\r\n  @popular_tags = Tag.find_most_popular(:limit =&gt; 30)\r\nend\r\n<\/pre>\n<p><\/code><\/p>\n<p>In the view<\/p>\n<p><code><\/p>\n<pre>\r\n&lt;ul id=\"tags\" class=\"tagcloud\"&gt;\r\n&lt;% @popular_tags.sort_by(&:name).each do |t| -%&gt;\r\n  &lt;%= weighted_tag t, tag_options %&gt;\r\n&lt;% end -%&gt;\r\n&lt;\/ul&gt;\r\n<\/pre>\n<p><\/code><\/p>\n<p>or, to get a somewhat nicer look, and to demonstrate some of the options<\/p>\n<p><code><\/p>\n<pre>\r\n&lt;%\r\n  tag_options = {\r\n    :wrap =&gt; ['li', '&lt;span class=\"dlm\"&gt;[&lt;\/span&gt;', '&lt;span class=\"dlm\"&gt;]&lt;\/span&gt;'],\r\n    :min_size =&gt; 100, :max_size =&gt; 500,\r\n    :link_options =&gt; { :class =&gt; 'tag' })\r\n  }\r\n-%&gt;\r\n&lt;h2&gt;Tags&lt;\/h2&gt;\r\n&lt;ul id=\"tags\" class=\"tagcloud\"&gt;\r\n&lt;% @popular_tags.sort_by(&:name).each do |t| -%&gt;\r\n  &lt;%= weighted_tag t, tag_options %&gt;\r\n&lt;% end -%&gt;\r\n&lt;\/ul&gt;\r\n<\/pre>\n<p><\/code><\/p>\n<p><a href=\"http:\/\/schuerig.de\/michael\/blog\/wp-content\/uploads\/2007\/06\/tag_cloud-0.0.2.tar.gz\">Here you can download a do-it-yourself kit of all the pieces.<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>On my continuing quest to become more Web-2.0-ish, I&#8217;ve tried my luck tilting at&#8230; well, tag clouds. To get an idea what I&#8217;m talking about, please have a look. These are the rudimentary basics to create a tag cloud like &hellip; <a href=\"https:\/\/www.schuerig.de\/michael\/blog\/index.php\/2007\/02\/22\/tag-cloud\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,8,5],"tags":[],"class_list":["post-23","post","type-post","status-publish","format-standard","hentry","category-css","category-javascript","category-rails"],"_links":{"self":[{"href":"https:\/\/www.schuerig.de\/michael\/blog\/index.php\/wp-json\/wp\/v2\/posts\/23","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.schuerig.de\/michael\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.schuerig.de\/michael\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.schuerig.de\/michael\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.schuerig.de\/michael\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=23"}],"version-history":[{"count":1,"href":"https:\/\/www.schuerig.de\/michael\/blog\/index.php\/wp-json\/wp\/v2\/posts\/23\/revisions"}],"predecessor-version":[{"id":143,"href":"https:\/\/www.schuerig.de\/michael\/blog\/index.php\/wp-json\/wp\/v2\/posts\/23\/revisions\/143"}],"wp:attachment":[{"href":"https:\/\/www.schuerig.de\/michael\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=23"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.schuerig.de\/michael\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=23"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.schuerig.de\/michael\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=23"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}