2020-03-19 09:54:47 +01:00
|
|
|
{{- $version := .Get 0 -}}
|
|
|
|
{{- $url := printf "https://github.com/dillonzq/LoveIt/releases/tag/v%s" $version -}}
|
2020-04-18 14:54:54 +02:00
|
|
|
{{- $type := .Get 1 | default "new" | lower -}}
|
|
|
|
{{- $label := T $type -}}
|
|
|
|
{{- $color := cond (eq $type "changed") "ff9101" "00b1ff" | cond (eq $type "deleted") "ff5252" -}}
|
2020-04-26 17:00:29 +02:00
|
|
|
{{- $pathTemplate := cond .Site.IsMultiLingual (printf "svg/version/%%s-%%s.%s.svg" .Page.Language.Lang) "svg/version/%s-%s.svg" -}}
|
|
|
|
{{- $path := printf $pathTemplate $version $type -}}
|
2020-04-18 14:54:54 +02:00
|
|
|
{{- $res := resources.Get "svg/version.template.svg" -}}
|
|
|
|
{{- $res = $res | resources.ExecuteAsTemplate $path (dict "version" $version "label" $label "color" $color) | minify -}}
|
2020-03-19 09:54:47 +01:00
|
|
|
{{- $alt := printf "LoveIt %s | %s" $label $version -}}
|
2020-04-23 10:49:30 +02:00
|
|
|
<a href="{{ $url }}" rel="noopener noreffer" target="_blank">{{ partial "plugin/image.html" (dict "src" $res.RelPermalink "alt" $alt "class" "version") }}</a>
|