diff options
Diffstat (limited to 'docs/_vendor/github.com/gohugoio/gohugoioTheme/layouts/partials/components/author-github-data.html')
-rw-r--r-- | docs/_vendor/github.com/gohugoio/gohugoioTheme/layouts/partials/components/author-github-data.html | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/docs/_vendor/github.com/gohugoio/gohugoioTheme/layouts/partials/components/author-github-data.html b/docs/_vendor/github.com/gohugoio/gohugoioTheme/layouts/partials/components/author-github-data.html index 25baea80a..fbad3a0a7 100644 --- a/docs/_vendor/github.com/gohugoio/gohugoioTheme/layouts/partials/components/author-github-data.html +++ b/docs/_vendor/github.com/gohugoio/gohugoioTheme/layouts/partials/components/author-github-data.html @@ -1,21 +1,36 @@ {{ $author := .context.Params.author }} {{ if $author }} <aside class="mw5 br3 mv3 nested-links"> - {{ $urlPre := "https://api.github.com" }} - {{ $user_json := getJSON $urlPre "/users/" $author }} - {{ if $user_json.name }} + + {{ $data := "" }} + {{ $url := urls.JoinPath "https://api.github.com/users" $author }} + {{ with resources.GetRemote $url }} + {{ with .Err }} + {{ errorf "%s" . }} + {{ else }} + {{ $data = . | transform.Unmarshal }} + {{ end }} + {{ else }} + {{ errorf "Unable to get remote resource %q" $url }} + {{ end }} + + {{ with $data }} + {{ with .name }} <h3 class="f4 dib"> - {{ $user_json.name | htmlEscape }} + {{ . | htmlEscape }} </h3> - {{ end }} - {{ if $user_json.bio }} + {{ with .bio }} <p class="lh-copy measure center mt0 f6 black-60"> - {{ $user_json.bio | htmlEscape }} + {{ . | htmlEscape }} </p> {{ end }} - <a href="{{ $user_json.html_url }}" class="link dim v-mid dib"> - {{ partial "svg/github-squared.svg" (dict "fill" "gray" "width" "16" "height" "18") }} - </a> + {{ with .html_url }} + <a href="{{ . }}" class="link dim v-mid dib"> + {{ partial "svg/github-squared.svg" (dict "fill" "gray" "width" "16" "height" "18") }} + </a> + {{ end }} + {{ end }} + </aside> {{ end }} |