Created
January 18, 2012 17:25
-
-
Save Bodacious/1634254 to your computer and use it in GitHub Desktop.
Adding a tag cloud to your Blogit blog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
<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> | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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