Path: blob/main/_plugins/by-tag-pages.rb
1677 views
require './_plugins/jekyll-topic-filter'12module Jekyll3module Generators4##5# This class generates the GTN's Tag Pages6class TagPageGenerator < Generator7safe true89##10# This generates the author pages11# Params12# +site+:: The site object13def generate(site)14if Jekyll.env == 'production'15_generate(site)16end17end1819def _generate(site)20Jekyll.logger.info '[GTN/SyntheticTopics] Generating By-Tag Indexes'21Gtn::TopicFilter.list_all_tags(site).map do |tag|22site.data["by_tag_#{tag}"] = {23'name' => "by_tag_#{tag}",24'type' => 'use',25'title' => tag,26'summary' => "Tutorials covering #{tag}",27'tag_based' => true,28'hidden' => true,29}3031topic_index = PageWithoutAFile.new(site, '', "tags/#{Jekyll::Utils.slugify(tag)}", 'index.md')32topic_index.content = ''33topic_index.data['layout'] = 'topic'34topic_index.data['topic_name'] = "by_tag_#{tag}"35topic_index.data['topic'] = site.data["by_tag_#{tag}"]3637site.pages << topic_index38end3940Jekyll.logger.info '[GTN/SyntheticTopics] Generating By-Tag Embeds'41Gtn::TopicFilter.list_all_tags(site).map do |tag|42topic_index = PageWithoutAFile.new(site, '', "tags/#{Jekyll::Utils.slugify(tag)}", 'embed.html')43topic_index.content = ''44topic_index.data['layout'] = 'topic-embed'45topic_index.data['topic_name'] = "by_tag_#{tag}"46topic_index.data['topic'] = site.data["by_tag_#{tag}"]4748site.pages << topic_index49end50end51end52end53end545556