Class: Jekyll::Document

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

Overview

class Document

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.



304
305
306
307
308
309
310
311
312
313
# File 'lib/jekyll-multiple-languages-plugin.rb', line 304

def populate_categories
  data['categories'].delete("_i18n")
  data['categories'].delete(site.config['lang'])
  
  merge_data!({
    'categories' => (
      Array(data['categories']) + Utils.pluralized_array_from_hash(data, 'category', 'categories')
    ).map(&:to_s).flatten.uniq
  })
end

#populate_categories_orgObject



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

alias :populate_categories_org :populate_categories