Created
March 12, 2014 14:38
-
-
Save technosophos/9508249 to your computer and use it in GitHub Desktop.
Jekyll Category Listing Plugin
This file contains hidden or 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 Jekyll | |
| class CategoryListTag < Liquid::Tag | |
| # safe true | |
| def initialize(tag_name, text, tokens) | |
| super | |
| end | |
| def render(context) | |
| html = "" | |
| categories = context.registers[:site].categories | |
| categories.each do |cat, posts| | |
| html << "<a href='/category/#{cat}/' class='radius label label-default'>#{cat}</a> " | |
| end | |
| html | |
| end | |
| end | |
| end | |
| Liquid::Template.register_tag('category_list', Jekyll::CategoryListTag) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment