Ensure the post categories are unique (only one). Ref: #2527 #2531

h/t @Nicholas-Perry
https://github.com/jekyll/jekyll/issues/2527#issuecomment-47041756
This commit is contained in:
Parker Moore 2014-06-24 19:15:02 -04:00
parent 579d9fc813
commit 6e104c3ed0
1 changed files with 3 additions and 2 deletions

View File

@ -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