diff --git a/_includes/topics.html b/_includes/topics.html index 45a7e6a..d32137f 100644 --- a/_includes/topics.html +++ b/_includes/topics.html @@ -1,5 +1,5 @@ \ No newline at end of file diff --git a/_plugins/fetch_posts.rb b/_plugins/fetch_posts.rb index c1d1d2d..cacceb5 100644 --- a/_plugins/fetch_posts.rb +++ b/_plugins/fetch_posts.rb @@ -40,28 +40,27 @@ class BeatrootNews < Jekyll::Generator # Main plugin action, called by Jekyll-core def generate(site) @site = site - site.data['topics'] = Set.new site.data['topics'] - count = 0 + # Topic Counter + site.data['topics'] = site.data['topics'].to_h {|topic| [topic, 0]} get_content.each do |article| page = make_page(article['attributes']['modules']) if page site.pages << page page['topics'].each do |topic| unless site.data['topics'].include? topic - site.data['topics'] << topic + site.data['topics'][topic] = 0 Jekyll.logger.warn "News:", "New Topic #{topic}" end end - count+=1 + site.data['topics'][page['topics'].first] += 1 end end - site.data['topics'].each do |topic| + site.data['topics'].each do |topic, count| @site.pages << make_topic_page(topic) end - site.data['topics'] = site.data['topics'].to_a.sort - Jekyll.logger.info "News:", "Generated #{count} pages" + Jekyll.logger.info "News:", "Generated #{site.data['topics'].values.sum} pages" end private diff --git a/index.html b/index.html index e2ebd33..f8a0e82 100644 --- a/index.html +++ b/index.html @@ -7,23 +7,17 @@ layout: default