# Plugin to help with releases require 'uri' module Jekyll class ReleaseTag < Liquid::Tag def initialize(tag, text, context) super @year, vol, thumbnail = text.split('|').map(&:strip) @title = "Norsk Urskog Metal Sampler, Vol #{vol} #{@year}" @thumbnail = Assets::Liquid::Tag.new('img', "#{thumbnail} magick:resize:400x alt:\"#{@title} cover\"", context) end def render(context) # context.environments[0][:page] # # {“lang”=>”no”, “layout”=>”default”, “title”=>”Utgivelser”, “page-lang”=>false, # “content”=>”...”, “dir”=>”/utgivelser/”, “name”=>”utgivelser.md”, “path”=>”utgivelser.md”, # “url”=>”/utgivelser/”} # page = context.environments[0][:page] %Q{
#{@thumbnail.render(context)}
#{@title}
} end end end Liquid::Template.register_tag('release', Jekyll::ReleaseTag)