summaryrefslogtreecommitdiff
path: root/themes/CodeIT/layouts/shortcodes/version.html
diff options
context:
space:
mode:
authorChristoph Cullmann <cullmann@kde.org>2021-02-18 22:21:36 +0100
committerChristoph Cullmann <cullmann@kde.org>2021-02-18 22:21:36 +0100
commit0c7cb4486a89ec6fe9680e6569ef41d4b82d557d (patch)
tree081941052bcab0caf69487b6bf5ab2df5deb3b7b /themes/CodeIT/layouts/shortcodes/version.html
parent640572ecab69291d2c266de2011b795a861e7c21 (diff)
use maintained theme
Diffstat (limited to 'themes/CodeIT/layouts/shortcodes/version.html')
-rw-r--r--themes/CodeIT/layouts/shortcodes/version.html13
1 files changed, 13 insertions, 0 deletions
diff --git a/themes/CodeIT/layouts/shortcodes/version.html b/themes/CodeIT/layouts/shortcodes/version.html
new file mode 100644
index 0000000..186f275
--- /dev/null
+++ b/themes/CodeIT/layouts/shortcodes/version.html
@@ -0,0 +1,13 @@
+{{- $version := .Get 0 -}}
+{{- $url := printf "https://github.com/sunt-programator/CodeIT/releases/tag/v%v" $version -}}
+{{- $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 -}}
+{{- $alt := printf "CodeIT %v | %v" $label $version -}}
+<a href="{{ $url }}" rel="noopener noreferrer" target="_blank">
+ {{- dict "Src" $resource.RelPermalink "Alt" $alt "Class" "version" | partial "plugin/image.html" -}}
+</a> \ No newline at end of file