Merge pull request #2269 from servedsmart/use-data-repo-colors-and-move-out-of-line

♻️ Refactor: Use universal json for repo shortcodes and move styles out of line
This commit is contained in:
Nuno C.
2025-07-10 11:37:41 +01:00
committed by GitHub
10 changed files with 42 additions and 1628 deletions

View File

@@ -1,7 +1,6 @@
{{ $id := delimit (slice "codeberg" (partial "functions/uid.html" .)) "-" }}
{{- $codebergURL := print "https://codeberg.org/api/v1/repos/" (.Get "repo") -}}
{{- $codebergData := resources.GetRemote $codebergURL | transform.Unmarshal -}}
{{- $codebergColors := .Site.Data.codebergColors -}}
{{- with $codebergData -}}
<div class="codeberg-card-wrapper">
<a id="{{ $id }}" target="_blank" href="{{ .html_url }}" class="cursor-pointer">
@@ -23,13 +22,10 @@
</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"
style="background-color: {{ if .language }}
{{- index $codebergColors .language -}}
{{ else }}
#0077b6
{{ end }}"></span>
class="mr-1 inline-block h-3 w-3 rounded-full {{ $className }}"></span>
<div class="m-0 mr-5 text-md text-neutral-800 dark:text-neutral">
{{ if .language }}{{ .language }}{{ else }}null{{ end }}
</div>