From 94c8fb53d136346af111b918d7474284acd43fa4 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Wed, 17 Apr 2019 19:58:49 +0200 Subject: =?UTF-8?q?Lag=20en=20tag=20for=20=C3=A5=20generere=20forh=C3=A5nd?= =?UTF-8?q?sbilder=20av=20utgivelser.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- blog/_assets/stylesheets/_releases.scss | 7 +++++++ blog/_assets/stylesheets/main.scss | 1 + blog/_plugins/releases.rb | 29 +++++++++++++++++++++++++++++ blog/en/releses.md | 2 +- blog/utgivelser.md | 3 ++- 5 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 blog/_assets/stylesheets/_releases.scss create mode 100644 blog/_plugins/releases.rb (limited to 'blog') diff --git a/blog/_assets/stylesheets/_releases.scss b/blog/_assets/stylesheets/_releases.scss new file mode 100644 index 0000000..97fc00d --- /dev/null +++ b/blog/_assets/stylesheets/_releases.scss @@ -0,0 +1,7 @@ +.release-thumbnail { + display: flex; + flex-direction: column; + width: 412px; + text-align: center; + padding-top: 2mm; +} diff --git a/blog/_assets/stylesheets/main.scss b/blog/_assets/stylesheets/main.scss index ffc99a5..3dbe471 100644 --- a/blog/_assets/stylesheets/main.scss +++ b/blog/_assets/stylesheets/main.scss @@ -7,6 +7,7 @@ @import "concerts"; @import "volunteers"; @import "tracklist"; +@import "releases"; body { background-color: black; 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{
+ #{@thumbnail.render(context)}
#{@title}
+
} + end + end +end + +Liquid::Template.register_tag('release', Jekyll::ReleaseTag) diff --git a/blog/en/releses.md b/blog/en/releses.md index b7f123e..a581d81 100644 --- a/blog/en/releses.md +++ b/blog/en/releses.md @@ -7,4 +7,4 @@ page-lang: en Here's an overview of our releases: -* [2019](/en/releases/2019) +{% release 2019|2019/NORSKURSKOG-2019_front-cover.jpg %} diff --git a/blog/utgivelser.md b/blog/utgivelser.md index 43d2587..b1b1ab1 100644 --- a/blog/utgivelser.md +++ b/blog/utgivelser.md @@ -7,4 +7,5 @@ page-lang: no Her er en oversikt over utgivelsene vi har gjort i regi av Norsk Urskog. -* [2019](/utgivelser/2019) +{% release 2019|2019/NORSKURSKOG-2019_front-cover.jpg %} + -- cgit v1.2.3