Path: blob/main/_plugins/generator-recordings.rb
1677 views
# frozen_string_literal: true12require './_plugins/gtn'34module Jekyll5module Generators6##7# This class generates the GTN's recording pages8class RecordingPageGenerator < Generator9safe true1011##12# This generates the recording pages, where needed.13# Params14# +site+:: The site object15def generate(site)16Jekyll.logger.info "[GTN/Videos] Generating recording pages"17materials = Gtn::TopicFilter18.list_all_materials(site)1920with_video = materials21.select{|m| m.has_key? 'recordings' or m.has_key? 'slide_recordings'}2223Jekyll.logger.info "[GTN/Videos] #{with_video.length} materials with recordings found."24materials.each do |material|25page2 = PageWithoutAFile.new(site, '', material['dir'], 'recordings/index.html')26page2.content = nil27page2.data['layout'] = 'recordings'28page2.data['topic_name'] = material['topic_name']29page2.data['tutorial_name'] = material['tutorial_name']30page2.data['material'] = material31page2.data['title'] = 'Recordings for ' + material['title']32site.pages << page233end34end35end36end37end383940