Class: JekyllOpenSdgPlugins::CreateIndicators
- Inherits:
-
Jekyll::Generator
- Object
- Jekyll::Generator
- JekyllOpenSdgPlugins::CreateIndicators
- Defined in:
- lib/jekyll-open-sdg-plugins/create_indicators.rb
Instance Method Summary collapse
Instance Method Details
#generate(site) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/jekyll-open-sdg-plugins/create_indicators.rb', line 8 def generate(site) # If site.create_indicators is set, create indicators per the metadata. if site.config['languages'] and site.config['create_indicators'] # Decide what layout to use for the indicator pages. layout = 'indicator' if site.config['create_indicators'].key?('layout') layout = site.config['create_indicators']['layout'] end # Loop through the languages. site.config['languages'].each_with_index do |language, index| # Loop through the indicators (using metadata as a list). site.data['meta'].each do |inid, | # Add the language subfolder for all except the default (first) language. dir = index == 0 ? inid : File.join(language, inid) # Create the indicator page. site.collections['indicators'].docs << IndicatorPage.new(site, site.source, dir, inid, language, layout) end end end end |