{{- /* GitHub repository. @param {string} (positional parameter 0) Repository name on GitHub. @returns {template.HTML} @examples {{< gh-repo "github/docs" >}} */ -}} {{- if (.Get 0) -}} {{ $repos := (split (.Get 0) "|") }} {{ $api := (site.Params.api) }} {{ $ts := (now.Unix) }} {{ $headers := (dict "User-Agent" ($api.user_agent) "Authorization" (printf "Bearer %s" (($api.github.token) | base64Decode)) ) }}
{{ range ($repos) }} {{ $repo := (getJSON ($api.github.url) "/repos/" . "?ts=" ($ts) ($headers)) }} {{ $owner := (getJSON ($repo.owner.url) "?ts=" ($ts) ($headers)) }}
{{ if ($repo.owner.avatar_url) }} {{ end }}
{{ ($repo.name) }}
{{ (($owner.name) | default ($owner.login)) }}
{{ if ($repo.description) }}

{{ (($repo.description) | plainify) }}

{{ end }}
{{ if ($repo.license) }} {{ $license := (getJSON ($repo.license.url) "?ts=" ($ts) ($headers)) }} {{ end }}
{{ end }}
{{- else -}} {{ (partial "alerts/no_params" .) }} {{- end -}}