diff --git a/Gemfile.lock b/Gemfile.lock index 9db6e24..9358fa2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -100,4 +100,4 @@ DEPENDENCIES uglifier BUNDLED WITH - 1.11.2 + 1.12.5 diff --git a/_includes/post/categories.html b/_includes/post/categories.html index 4a98b29..5ed19b4 100644 --- a/_includes/post/categories.html +++ b/_includes/post/categories.html @@ -1,10 +1,10 @@ -{% capture category %}{% if post %}{{ post.categories | category_links | size }}{% else %}{{ page.categories | category_links | size }}{% endif %}{% endcapture %} +{% capture category %}{% if post %}{{ post.categories | category_list | size }}{% else %}{{ page.categories | category_list | size }}{% endif %}{% endcapture %} {% unless category == '0' %} {% if post %} - {{ post.categories | category_links }} + {{ post.categories | category_list }} {% else %} - {{ page.categories | category_links }} + {{ page.categories | category_list }} {% endif %} {% endunless %} diff --git a/_plugins/categories.rb b/_plugins/categories.rb new file mode 100644 index 0000000..69e437a --- /dev/null +++ b/_plugins/categories.rb @@ -0,0 +1,15 @@ +module Jekyll + module Filters + + # Outputs a list of categories as comma-separated links. This is used + # to output the category list for each post on a category page. + # + # +categories+ is the list of categories to format. + # + # Returns string + # + def category_list(categories) + categories.sort.join(', ') + end + end +end