Skip to content

Instantly share code, notes, and snippets.

@Bodacious
Created January 18, 2012 17:25
Show Gist options
  • Save Bodacious/1634254 to your computer and use it in GitHub Desktop.
Save Bodacious/1634254 to your computer and use it in GitHub Desktop.
Adding a tag cloud to your Blogit blog
...
<aside id="right">
<nav id="tag_cloud">
<h3>Browse by topic:</h3>
<% tag_cloud(tags, %w(tag1 tag2 tag3 tag4 tag5 tag6)) do |tag, tag_class| %>
<%= link_to tag.name, tagged_blog_posts_path(tag: tag.name), :class => "tag #{tag_class}" %>
<% end %>
</nav>
</aside>
...
module BlogPostsHelper
include ActsAsTaggableOn::TagsHelper
def tags
@tags ||= Blogit::Post.tag_counts_on(:tags)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment