{{- /* GitHub user. @param {string} (positional parameter 0) User name on GitHub. @returns {template.HTML} @examples {{< gh-user "octocat" >}} */ -}} {{- if (.Get 0) -}} {{ $users := (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 ($users) }} {{ $user := (getJSON ($api.github.url) "/users/" . "?ts=" ($ts) ($headers)) }}
{{ if ($user.avatar_url) }} {{ end }}
{{ (($user.name) | default ($user.login)) }}
{{ if ($user.bio) }}

{{ (($user.bio) | plainify) }}

{{ end }}
{{ if ($user.blog) }}
{{ $url := (urls.Parse ($user.blog)) }}{{ $scheme := "http://" }} {{ if ($url.Scheme) }}{{ $scheme = "" }}{{ end }}
{{ end }}
{{ end }}
{{- else -}} {{ (partial "alerts/no_params" .) }} {{- end -}}