fix(repo-card): manually revert to the version in 2.87.0

The md5 method has severe performance degradation
It is approximately 2x slower without cache and 5x slower with cache

Reverted due to lack of a better option
This commit is contained in:
ZhenShuo Leo
2025-07-17 02:50:42 +08:00
parent 2ff6b0e8bd
commit 5009fffcf4
6 changed files with 28 additions and 41 deletions

View File

@@ -1,5 +1,6 @@
{{ $id := delimit (slice "codeberg" (partial "functions/uid.html" .)) "-" }}
{{- $codebergURL := print "https://codeberg.org/api/v1/repos/" (.Get "repo") -}}
{{- $codebergColors := .Site.Data.repoColors -}}
{{- $codebergData := dict -}}
{{- with try (resources.GetRemote $codebergURL) -}}
{{- with .Err -}}
@@ -32,10 +33,13 @@
</p>
<div class="m-0 mt-2 flex items-center">
{{ $language := .language | default "fallback" }}
{{ $className := printf "background-color-%s" (md5 $language) }}
<span
class="mr-1 inline-block h-3 w-3 rounded-full {{ $className }}"></span>
class="mr-1 inline-block h-3 w-3 rounded-full"
style="background-color: {{ if .language }}
{{- index $codebergColors .language -}}
{{ else }}
#0077b6
{{ end }}"></span>
<div class="m-0 mr-5 text-md text-neutral-800 dark:text-neutral">
{{ if .language }}{{ .language }}{{ else }}null{{ end }}
</div>