diff --git a/layouts/partials/vendor.html b/layouts/partials/vendor.html index a0f0ec54..31872d08 100644 --- a/layouts/partials/vendor.html +++ b/layouts/partials/vendor.html @@ -131,27 +131,17 @@ {{ $repoColors := site.Data.repoColors }} {{ $cssRules := slice }} - {{ $usedLanguages := $.Page.Store.Get "repoCardLanguages" }} - {{ if not $usedLanguages }} - {{ $usedLanguages = slice "default" }} - {{ else }} - {{ $usedLanguages = $usedLanguages | append "default" }} + {{/* default color */}} + {{ $cssRules = $cssRules | append ".language-dot[data-language=\"default\"] { background-color: #0077b6; }" }} + + {{/* Hugging Face model color */}} + {{ $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) }} {{ end }} - - {{ range $usedLanguages }} - {{ if eq . "default" }} - {{ $cssRules = $cssRules | append ".language-dot[data-language=\"default\"] { background-color: #0077b6; }" }} - {{ else if eq . "model" }} - {{ $cssRules = $cssRules | append ".language-dot[data-language=\"model\"] { background-color: #ff6b35; }" }} - {{ else if index $repoColors . }} - {{ $color := index $repoColors . }} - {{ $cssRules = $cssRules | append (printf ".language-dot[data-language=\"%s\"] { background-color: %s; }" . $color) }} - {{ end }} - {{ end }} - - {{ $cssContent := delimit $cssRules "\n" }} - {{ $outputPath := path.Join .Page.RelPermalink "repo-cards.css" }} - {{ $repoCardCSS := resources.FromString $outputPath $cssContent | minify | resources.Fingerprint (.Site.Params.fingerprintAlgorithm | default "sha512") }} - + {{ $repoCardCSS := resources.FromString "css/repo-cards.css" (delimit $cssRules "\n") + | minify | resources.Fingerprint (.Site.Params.fingerprintAlgorithm | default "sha512") + }} {{ end }} diff --git a/layouts/shortcodes/codeberg.html b/layouts/shortcodes/codeberg.html index 86918aa2..bb1921e4 100644 --- a/layouts/shortcodes/codeberg.html +++ b/layouts/shortcodes/codeberg.html @@ -33,12 +33,7 @@

- {{ $language := cond .language .language "default" }} - {{ $currentLangs := $.Page.Store.Get "repoCardLanguages" | default slice }} - {{ $.Page.Store.Set "repoCardLanguages" ($currentLangs | append $language) }} - +
{{ if .language }}{{ .language }}{{ else }}null{{ end }}
diff --git a/layouts/shortcodes/forgejo.html b/layouts/shortcodes/forgejo.html index 5990acfd..43b9f0e8 100644 --- a/layouts/shortcodes/forgejo.html +++ b/layouts/shortcodes/forgejo.html @@ -33,12 +33,7 @@

- {{ $language := cond .language .language "default" }} - {{ $currentLangs := $.Page.Store.Get "repoCardLanguages" | default slice }} - {{ $.Page.Store.Set "repoCardLanguages" ($currentLangs | append $language) }} - +
{{ if .language }}{{ .language }}{{ else }}null{{ end }}
diff --git a/layouts/shortcodes/gitea.html b/layouts/shortcodes/gitea.html index 1aa61765..e3782391 100644 --- a/layouts/shortcodes/gitea.html +++ b/layouts/shortcodes/gitea.html @@ -33,12 +33,7 @@

- {{ $language := cond .language .language "default" }} - {{ $currentLangs := $.Page.Store.Get "repoCardLanguages" | default slice }} - {{ $.Page.Store.Set "repoCardLanguages" ($currentLangs | append $language) }} - +
{{ if .language }}{{ .language }}{{ else }}null{{ end }}
diff --git a/layouts/shortcodes/github.html b/layouts/shortcodes/github.html index cbf0b83a..a8438f51 100644 --- a/layouts/shortcodes/github.html +++ b/layouts/shortcodes/github.html @@ -46,12 +46,7 @@

- {{ $language := cond .language .language "default" }} - {{ $currentLangs := $.Page.Store.Get "repoCardLanguages" | default slice }} - {{ $.Page.Store.Set "repoCardLanguages" ($currentLangs | append $language) }} - +
{{ if .language }}{{ .language }}{{ else }}null{{ end }}
diff --git a/layouts/shortcodes/huggingface.html b/layouts/shortcodes/huggingface.html index 8aa55a95..03e6bf04 100644 --- a/layouts/shortcodes/huggingface.html +++ b/layouts/shortcodes/huggingface.html @@ -53,12 +53,7 @@
- {{ $language := cond (eq $type "model") "model" "default" }} - {{ $currentLangs := $.Page.Store.Get "repoCardLanguages" | default slice }} - {{ $.Page.Store.Set "repoCardLanguages" ($currentLangs | append $language) }} - +
{{ if eq $type "model" }} {{ if .pipeline_tag }}{{ .pipeline_tag }}{{ else }}model{{ end }}