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.



273
274
275
276
277
278
279
280
281
282
283
# File 'lib/jekyll-multiple-languages-plugin.rb', line 273

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



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

alias :populate_categories_org :populate_categories