Class: Jekyll::Post

Inherits:
Object
  • Object
show all
Defined in:
lib/jekyll-multiple-languages-plugin.rb

Overview

class Post

Instance Method Summary collapse

Instance Method Details

#populate_categoriesObject

populate_categories

Monkey patched this method to remove unwanted strings (“_i18n” and language code) that are prepended to posts categories because of how the multilingual posts are arranged in subfolders.



308
309
310
311
312
313
314
315
316
317
318
# File 'lib/jekyll-multiple-languages-plugin.rb', line 308

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}.flatten.uniq
  
  self.categories.delete("_i18n")
  self.categories.delete(site.config['lang'])
  
  return self.categories
end

#populate_categories_orgObject



299
# File 'lib/jekyll-multiple-languages-plugin.rb', line 299

alias :populate_categories_org :populate_categories