{{- $url := .url | default "#" -}} {{- $label := .label | default "Learn more" -}} {{- $style := .style | default "primary" -}} {{- $github := .github -}} {{- $stars := "" -}} {{- with $github -}} {{- with try (resources.GetRemote (printf "https://api.github.com/repos/%s" .)) -}} {{- with .Value -}} {{- with .Content | transform.Unmarshal -}} {{- $count := int .stargazers_count -}} {{- if ge $count 1000 -}} {{- $stars = replace (printf "%.1fk" (div (float $count) 1000)) ".0k" "k" -}} {{- else -}} {{- $stars = printf "%d" $count -}} {{- end -}} {{- end -}} {{- end -}} {{- end -}} {{- end -}} {{- if $github }} {{ partial "icon.html" "github" }} {{ end -}} {{ $label | markdownify }} {{- if $stars }} {{ partial "icon.html" "star" }} {{ $stars }} {{- else }} {{ partial "icon.html" "link" }} {{- end }}