From fd4db04d3a6676f0db6dad6d65705b96cdf4b52a Mon Sep 17 00:00:00 2001 From: Brandon Rozek Date: Sun, 15 Jun 2025 22:32:52 -0400 Subject: [PATCH] Updated hugo way --- layouts/partials/highfive.html | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/layouts/partials/highfive.html b/layouts/partials/highfive.html index 0ff1f1f..2539adf 100644 --- a/layouts/partials/highfive.html +++ b/layouts/partials/highfive.html @@ -35,13 +35,12 @@ {{ $apiUrl := printf "https://api.brandonrozek.com/highfive%s" .RelPermalink }} -{{ $resource := resources.GetRemote $apiUrl }} {{ $initialCount := 0 }} -{{ if $resource }} - {{ with $resource.Err }} - {{ warnf "Failed to fetch highfive data from %s: %s" $apiUrl . }} - {{ $initialCount = 0 }} +{{ with try (resources.GetRemote $apiUrl) }} + {{ with .Err }} + {{ warnf "Failed to fetch highfive data from %s" $apiUrl }} {{ else }} + {{ $resource := .Value }} {{ $highfiveData := $resource | transform.Unmarshal }} {{ if $highfiveData.count }} {{ $initialCount = $highfiveData.count }}