From 6e104c3ed0c080edb2fef8ecd418de2972a48882 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Tue, 24 Jun 2014 19:15:02 -0400 Subject: [PATCH] Ensure the post categories are unique (only one). Ref: #2527 #2531 h/t @Nicholas-Perry https://github.com/jekyll/jekyll/issues/2527#issuecomment-47041756 --- lib/jekyll/post.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index 6cd6e938..f13d8b2c 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -78,8 +78,9 @@ module Jekyll def populate_categories categories_from_data = Utils.pluralized_array_from_hash(data, 'category', 'categories') - self.categories = (Array(categories) + categories_from_data).map {|c| c.to_s.downcase} - categories.flatten! + self.categories = ( + Array(categories) + categories_from_data + ).map {|c| c.to_s.downcase}.flatten.uniq end def populate_tags