1
0
Fork 0
mirror of https://github.com/dillonzq/LoveIt.git synced 2025-03-26 00:17:00 +01:00

feat(shortcode): update version shortcode ()

This commit is contained in:
Dillon 2025-03-06 00:00:42 +08:00 committed by GitHub
parent 00de2c353f
commit 4107eb8add
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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" -}}