mirror of
https://github.com/nunocoracao/blowfish.git
synced 2026-01-30 16:31:52 +01:00
feat(shortcodes): Display a thumbnail for GitHub repos
This commit is contained in:
committed by
Aleksey Smyrnov
parent
1d21656d5e
commit
2bbcd3ab8c
@@ -2,13 +2,20 @@
|
||||
{{- $githubURL := print "https://api.github.com/repos/" (.Get "repo") -}}
|
||||
{{- $githubData := resources.GetRemote $githubURL | transform.Unmarshal -}}
|
||||
{{- $githubColors := .Site.Data.githubColors -}}
|
||||
{{- with $githubData -}}
|
||||
{{- $githubThumbnailURL := print "https://opengraph.githubassets.com/0/" (.Get "repo") -}}
|
||||
|
||||
<div class="github-card-wrapper">
|
||||
|
||||
{{- if (.Get "showThumbnail") -}}
|
||||
<div class="w-full thumbnail_card nozoom" style="background-image:url({{ $githubThumbnailURL }});"></div>
|
||||
{{- end -}}
|
||||
|
||||
{{- with $githubData -}}
|
||||
<a id="{{ $id }}" target="_blank" href="{{ .html_url }}" class="cursor-pointer">
|
||||
<div
|
||||
class="w-full md:w-auto pt-3 p-5 border border-neutral-200 dark:border-neutral-700 border rounded-md shadow-2xl">
|
||||
|
||||
|
||||
<div class="flex items-center">
|
||||
<span class="text-2xl text-neutral-800 dark:text-neutral" style="margin-right:10px;">
|
||||
{{ partial "icon.html" "github" }}
|
||||
@@ -65,5 +72,6 @@
|
||||
.catch(error => console.error(error))
|
||||
</script>
|
||||
</a>
|
||||
</div>
|
||||
{{- end -}}
|
||||
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user