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 "github" (partial "functions/uid.html" .)) "-" }}
{{- $githubURL := print "https://api.github.com/repos/" (.Get "repo") -}}
{{- $githubData := resources.GetRemote $githubURL | transform.Unmarshal -}}
{{- $githubColors := .Site.Data.githubColors -}}
{{- $githubThumbnailURL := print "https://opengraph.githubassets.com/0/" (.Get "repo") -}}
{{- $showThumbnail := .Get "showThumbnail" | default true -}}
@@ -38,13 +37,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 $githubColors .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>
@@ -76,5 +72,4 @@
data-repo-id="{{ $id }}"></script>
</a>
{{- end -}}
</div>