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.



223
224
225
226
227
228
229
230
231
232
# File 'lib/jekyll-multiple-languages-plugin.rb', line 223

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



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

alias :populate_categories_org :populate_categories