fix: skip null colors in repoColors when generating repo-cards CSS

Languages with null entries in repoColors.json caused Go's fmt.Sprintf
to emit '%!s(<nil>)' as the color value, producing invalid CSS and
browser parse errors. Add a nil guard to skip those entries, letting
them fall back to the default dot color.

Fixes #2824
This commit is contained in:
Daniel von Eßen
2026-03-06 16:27:23 +01:00
parent d0a1a5b249
commit 9e0ad31ec8
+3 -1
View File
@@ -134,7 +134,9 @@
{{ $cssRules = $cssRules | append ".language-dot[data-language=\"model\"] { background-color: #ff6b35; }" }}
{{ range $lang, $color := $repoColors }}
{{ $cssRules = $cssRules | append (printf ".language-dot[data-language=\"%s\"] { background-color: %s; }" $lang $color) }}
{{ if $color }}
{{ $cssRules = $cssRules | append (printf ".language-dot[data-language=\"%s\"] { background-color: %s; }" $lang $color) }}
{{ end }}
{{ end }}
{{ $repoCardCSS := resources.FromString "css/repo-cards.css" (delimit $cssRules "\n")
| minify | resources.Fingerprint (.Site.Params.fingerprintAlgorithm | default "sha512")