diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2019-04-17 19:58:49 +0200 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2019-04-17 19:58:49 +0200 |
commit | 94c8fb53d136346af111b918d7474284acd43fa4 (patch) | |
tree | 2d1bdf0bbcb0ef5b359417be9e9f964d271f72d4 /blog | |
parent | 7b6441eb6d63f9d01d1684940c85b8886ad494e5 (diff) | |
download | norsk-urskog-main-94c8fb53d136346af111b918d7474284acd43fa4.tar.gz norsk-urskog-main-94c8fb53d136346af111b918d7474284acd43fa4.tar.bz2 norsk-urskog-main-94c8fb53d136346af111b918d7474284acd43fa4.zip |
Lag en tag for å generere forhåndsbilder av utgivelser.
Diffstat (limited to 'blog')
-rw-r--r-- | blog/_assets/stylesheets/_releases.scss | 7 | ||||
-rw-r--r-- | blog/_assets/stylesheets/main.scss | 1 | ||||
-rw-r--r-- | blog/_plugins/releases.rb | 29 | ||||
-rw-r--r-- | blog/en/releses.md | 2 | ||||
-rw-r--r-- | blog/utgivelser.md | 3 |
5 files changed, 40 insertions, 2 deletions
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{<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) 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 %} + |