1
0
Fork 0
mirror of https://github.com/dillonzq/LoveIt.git synced 2025-04-27 06:06:20 +02:00

feature(shortcode): update version shortcode

This commit is contained in:
Dillon 2025-03-05 23:46:45 +08:00
parent 00de2c353f
commit ce9b453bf3

View file

@ -2,7 +2,11 @@
{{- $url := printf "https://github.com/dillonzq/LoveIt/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" -}}
{{- $colorMap := dict "new" "00b1ff" -}}
{{- $colorMap = dict "changed" "81bd65" | merge $colorMap -}}
{{- $colorMap = dict "deleted" "ff5252" | merge $colorMap -}}
{{- $colorMap = dict "deprecated" "ff9101" | merge $colorMap -}}
{{- $color := index $colorMap $type | default (index $colorMap "new") -}}
{{- $pathTemplate := cond hugo.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" -}}