LoveIt/layouts/shortcodes/version.html

10 lines
No EOL
753 B
HTML

{{- $version := .Get 0 -}}
{{- $url := printf "https://github.com/dillonzq/LoveIt/releases/tag/v%s" $version -}}
{{- $type := .Get 1 | default "new" | lower -}}
{{- $label := T $type -}}
{{- $color := cond (eq $type "changed") "ff9101" "00b1ff" | cond (eq $type "deleted") "ff5252" -}}
{{- $path := printf "svg/version/%s-%s.svg" $version $label -}}
{{- $res := resources.Get "svg/version.template.svg" -}}
{{- $res = $res | resources.ExecuteAsTemplate $path (dict "version" $version "label" $label "color" $color) | minify -}}
{{- $alt := printf "LoveIt %s | %s" $label $version -}}
<span class="version"><a href="{{ $url }}" rel="noopener noreffer" target="_blank">{{ partial "plugin/image.html" (dict "src" $res.RelPermalink "alt" $alt) }}</a></span>