{{ $id := delimit (slice "github" (partial "functions/uid.html" .)) "-" }} {{- $githubURL := print "https://api.github.com/repos/" (.Get "repo") -}} {{- $githubThumbnailURL := print "https://opengraph.githubassets.com/0/" (.Get "repo") -}} {{- $showThumbnail := .Get "showThumbnail" | default true -}} {{- $repoColors := .Site.Data.repoColors -}} {{- $githubData := dict -}} {{- with try (resources.GetRemote $githubURL) -}} {{- with .Err -}} {{- warnf "github shortcode: failed to fetch remote resource from %q: %s" $githubURL $.Position -}} {{- else with .Value -}} {{- $githubData = . | transform.Unmarshal -}} {{- else -}} {{- warnf "github shortcode: unable to get remote resource from %q: %s" $githubURL $.Position -}} {{- end -}} {{- end -}} {{- with $githubData -}}
{{- if $showThumbnail -}}
GitHub Repository Thumbnail
{{- end -}}
{{ partial "icon.html" "github" }}
{{ .full_name | markdownify }}

{{ .description | markdownify }}

{{ if .language }}{{ .language }}{{ else }}null{{ end }}
{{ partial "icon.html" "star" }}
{{ .stargazers_count }}
{{ partial "icon.html" "fork" }}
{{ .forks }}
{{ $fetchRepo := resources.Get "js/fetch-repo.js" }} {{ $fetchRepo = $fetchRepo | resources.Minify | resources.Fingerprint ($.Site.Params.fingerprintAlgorithm | default "sha512") }}
{{- else -}} {{ warnf "github shortcode: unable to fetch %q: %s" $githubURL .Position }} {{- end -}}