docs: improve version used for docs (#188)

This commit is contained in:
Dillon
2020-03-19 16:54:47 +08:00
committed by GitHub
parent 774e831a21
commit a9850f7df3
15 changed files with 82 additions and 47 deletions

View File

@@ -1 +1,7 @@
<span class="version"><i class="far fa-heart fa-fw"></i> LoveIt <i class="fas fa-greater-than-equal fa-fw"></i> <a href="https://github.com/dillonzq/LoveIt/releases/tag/v{{ .Get 0 }}" rel="noopener noreffer" target="_blank" title="LoveIt v{{ .Get 0 }}">{{ .Get 0 }}</a></span>
{{- $version := .Get 0 -}}
{{- $url := printf "https://github.com/dillonzq/LoveIt/releases/tag/v%s" $version -}}
{{- $label := .Get 1 | default "new" | T -}}
{{- $color := cond (.Get 1 | eq "changed") "ff9101" "00b1ff" | cond (.Get 1 | eq "deleted") "ff5252" -}}
{{- $badge := printf "https://img.shields.io/badge/%s-%s-%s?style=flat-square&labelColor=403c3d&?cacheSeconds=maxAge" $label $version $color -}}
{{- $alt := printf "LoveIt %s | %s" $label $version -}}
<span class="version{{ if .Get 2 | eq `small` }} small{{ end }}"><a href="{{ $url }}" rel="noopener noreffer" target="_blank">{{ partial "plugin/image.html" (dict "src" $badge "alt" $alt) }}</a></span>