Sha256: 3786a20eb388dc8619cc11530e0e24abda720929d8420e8d4747d7c7eba246d1
Contents?: true
Size: 1.62 KB
Versions: 13
Compression:
Stored size: 1.62 KB
Contents
module Jekyll class PodigeePlayerTag < Liquid::Tag def playerconfig(context) config = context.registers[:site].config page = context.registers[:page] audio = {} download_url = config["download_url"] || config["url"] + "/episodes" page["audio"].each { |key, value| audio[key] = download_url + "/" + value} { options: { theme: "default", startPanel: "ChapterMarks" }, extensions: { ChapterMarks: {}, EpisodeInfo: {}, Playlist: {} }, title: options['title'], episode: { media: audio, coverUrl: config['url'] + (page["episode_cover"] || '/img/logo-360x360.png'), title: page["title"], subtitle: page["subtitle"], url: config['url'] + page["url"], description: page["description"], chaptermarks: page["chapters"].map {|chapter| { start: chapter[0..12], title: chapter[13..255] }} } }.to_json end def render(context) config = context.registers[:site].config page = context.registers[:page] return unless page["audio"] return <<~HTML <script> window.playerConfiguration = #{playerconfig(context)} </script> <script class="podigee-podcast-player" data-configuration="playerConfiguration" src="#{config["url"].split(":").first}://cdn.podigee.com/podcast-player/javascripts/podigee-podcast-player.js"> </script> HTML end end end Liquid::Template.register_tag('podigee_player', Jekyll::PodigeePlayerTag)
Version data entries
13 entries across 13 versions & 2 rubygems