summaryrefslogtreecommitdiffstats
path: root/blog/_plugins
diff options
context:
space:
mode:
Diffstat (limited to 'blog/_plugins')
-rw-r--r--blog/_plugins/releases.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/blog/_plugins/releases.rb b/blog/_plugins/releases.rb
new file mode 100644
index 0000000..b9f71b5
--- /dev/null
+++ b/blog/_plugins/releases.rb
@@ -0,0 +1,29 @@
+# Plugin to help with releases
+
+require 'uri'
+
+module Jekyll
+ class ReleaseTag < Liquid::Tag
+ def initialize(tag, text, context)
+ super
+ @year, thumbnail = text.split('|').map(&:strip)
+ @title = "Norsk Urskog Metal Sampler, #{@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{<div class="release-thumbnail">
+ <a href="#{page['url']}#{@year}">#{@thumbnail.render(context)}<div class="release-thumbnail-title">#{@title}</div></a>
+ </div>}
+ end
+ end
+end
+
+Liquid::Template.register_tag('release', Jekyll::ReleaseTag)