Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
galaxyproject
GitHub Repository: galaxyproject/training-material
Path: blob/main/_plugins/gtn/synthetic.rb
1677 views
1
# frozen_string_literal: true
2
3
require './_plugins/jekyll-topic-filter'
4
5
module Jekyll
6
module Generators
7
# Generates synthetic topics from tutorials with specific tags
8
class SyntheticTopicGenerator < Generator
9
def generate(site)
10
# Full Bibliography
11
Jekyll.logger.info '[GTN/SyntheticTopics] Generating Indexes'
12
13
Gtn::TopicFilter.list_topics(site).select { |t| site.data[t]['tag_based'] }.each do |topic|
14
Jekyll.logger.debug "[GTN/SyntheticTopics] Creating #{topic} topic"
15
16
topic_index = PageWithoutAFile.new(site, '', "topics/#{topic}", 'index.md')
17
topic_index.content = ''
18
topic_index.data['layout'] = 'topic'
19
topic_index.data['topic_name'] = topic
20
site.pages << topic_index
21
22
# For now, intentionally no FAQ
23
# faq_index = PageWithoutAFile.new(site, "", "topics/#{topic}/faqs", "index.md")
24
# faq_index.content = ""
25
# faq_index.data["layout"] = "faq-page"
26
# site.pages << faq_index
27
end
28
end
29
end
30
end
31
end
32
33