cullmann.io/themes/CodeIT/layouts/shortcodes/version.html

13 lines
902 B
HTML
Raw Normal View History

2021-02-18 21:44:01 +01:00
{{- $version := .Get 0 -}}
2021-02-18 22:21:36 +01:00
{{- $url := printf "https://github.com/sunt-programator/CodeIT/releases/tag/v%v" $version -}}
2021-02-18 21:44:01 +01:00
{{- $type := .Get 1 | default "new" | lower -}}
{{- $label := T $type -}}
{{- $color := cond (eq $type "changed") "ff9101" "00b1ff" | cond (eq $type "deleted") "ff5252" -}}
{{- $pathTemplate := cond .Site.IsMultiLingual (printf "svg/version/%%v-%%v.%v.svg" .Page.Language.Lang) "svg/version/%v-%v.svg" -}}
{{- $path := printf $pathTemplate $version $type -}}
{{- $resource := resources.Get "svg/version.template.svg" -}}
{{- $resource = $resource | resources.ExecuteAsTemplate $path (dict "version" $version "label" $label "color" $color) | minify -}}
2021-02-18 22:21:36 +01:00
{{- $alt := printf "CodeIT %v | %v" $label $version -}}
<a href="{{ $url }}" rel="noopener noreferrer" target="_blank">
2021-02-18 21:44:01 +01:00
{{- dict "Src" $resource.RelPermalink "Alt" $alt "Class" "version" | partial "plugin/image.html" -}}
</a>