Files
Oliver Hamlet aa66a10fd8 Fetch contributors data at build time
It's currently easy to hit the GitHub API's rate limit just by refreshing the credits page a couple of times. The data doesn't change that frequently, so instead fetch it into a JSON file as part of the build process, have Hugo generate the page using the JSON file and a template, and deploy the site each day at midnight so that the live data is at most 24 hours old.
2026-01-11 22:57:28 +00:00

23 lines
738 B
HTML

{{ define "main" }}
{{ .Content }}
<div id="contrib">
{{ $contributors := .Resources.Get "contributors.json" | transform.Unmarshal }}
{{ range $contributors }}
<a href="{{ .html_url }}" class="loot-contributor mdl-shadow--2dp">
<div class="loot-contributor__avatar">
{{- if .avatar_url }}
<img src="{{ .avatar_url }}"/>
{{- else }}
<i class="material-icons">face</i>
{{- end }}
</div>
<div class="loot-contributor__text">
<div class="loot-contributor__name">{{ .name }}</div>
<div class="loot-contributor__contributions">{{ .contributions }} contributions</div>
</div>
</a>
{{ end }}
</div>
{{ end }}