commit 532cbf0bc8f212f87b2d0f448bc81d505c80f562 parent c6e2f19879e43e570de7c3a520b1c2defd93c256 Author: Ed van Bruggen <ed@edryd.org> Date: Mon, 6 Apr 2026 23:51:44 -0400 Replace depreciated getJSON in new hugo version Diffstat:
| M | layouts/projects/projects.html | | | 20 | +++++++++++++++----- |
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/layouts/projects/projects.html b/layouts/projects/projects.html @@ -35,12 +35,22 @@ {{ end }} <h2 class="heading pt-4">SCRIPTS</h2> {{ range $.Site.Data.projects.scripts }} - {{ $gist := getJSON "https://api.github.com/gists/" .id }} {{ $link := path.Join "projects/" .name | relURL }} - <div class="row text-inc"> - <div class="col-lg-4 text-lg-right"><a href="{{ $link }}">{{ .name }}</a></div> - <div class="col-lg-8"><a href="{{ $link }}" class="italic-off text-primary">{{ $gist.description }}</a></div> - </div> + {{ $name := .name }} + {{ $url := printf "https://api.github.com/gists/%s" .id }} + {{ with try (resources.GetRemote $url) }} + {{ with .Err }} + {{ errorf "%s" . }} + {{ else with .Value }} + {{ $gist := . | transform.Unmarshal }} + <div class="row text-inc"> + <div class="col-lg-4 text-lg-right"><a href="{{ $link }}">{{ $name }}</a></div> + <div class="col-lg-8"><a href="{{ $link }}" class="italic-off text-primary">{{ $gist.description }}</a></div> + </div> + {{ else }} + {{ errorf "Unable to get remote resource %q" $url }} + {{ end }} + {{ end }} {{ end }} </div> </div>