8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/jekyll-open-sdg-plugins/create_goals.rb', line 8
def generate(site)
if site.config['languages'] and site.config['create_goals']
goals = {}
site.data['meta'].each do |inid, meta|
goal = inid.split('-')[0].to_i
goals[goal] = true
end
layout = 'goal'
if site.config['create_goals'].key?('layout')
layout = site.config['create_goals']['layout']
end
site.config['languages'].each_with_index do |language, index|
goals.sort.each do |goal, value|
dir = index == 0 ? goal.to_s : File.join(language, goal.to_s)
site.collections['goals'].docs << GoalPage.new(site, site.source, dir, goal, language, layout)
end
end
end
end
|