diff --git a/config.toml b/config.toml index 7c50e6f5..93be407e 100644 --- a/config.toml +++ b/config.toml @@ -1,5 +1,5 @@ [module] [module.hugoVersion] extended = true -min = "0.137.0" +min = "0.141.0" max = "0.148.1" \ No newline at end of file diff --git a/layouts/shortcodes/codeberg.html b/layouts/shortcodes/codeberg.html index ccaeca18..787db9e4 100644 --- a/layouts/shortcodes/codeberg.html +++ b/layouts/shortcodes/codeberg.html @@ -1,6 +1,16 @@ {{ $id := delimit (slice "codeberg" (partial "functions/uid.html" .)) "-" }} {{- $codebergURL := print "https://codeberg.org/api/v1/repos/" (.Get "repo") -}} -{{- $codebergData := resources.GetRemote $codebergURL | transform.Unmarshal -}} +{{- $codebergData := dict -}} +{{- with try (resources.GetRemote $codebergURL) -}} + {{- with .Err -}} + {{- warnf "codeberg shortcode: failed to fetch remote resource from %q: %s" $codebergURL .Position -}} + {{- else with .Value -}} + {{- $codebergData = . | transform.Unmarshal -}} + {{- else -}} + {{- warnf "codeberg shortcode: unable to get remote resource from %q: %s" $codebergURL .Position -}} + {{- end -}} +{{- end -}} + {{- with $codebergData -}}
diff --git a/layouts/shortcodes/forgejo.html b/layouts/shortcodes/forgejo.html index 775a3a59..a66a2631 100644 --- a/layouts/shortcodes/forgejo.html +++ b/layouts/shortcodes/forgejo.html @@ -1,6 +1,16 @@ {{ $id := delimit (slice "forgejo" (partial "functions/uid.html" .)) "-" }} {{- $forgejoURL := print (.Get "server" | default .Site.Params.forgejoDefaultServer) "/api/v1/repos/" (.Get "repo") -}} -{{- $forgejoData := resources.GetRemote $forgejoURL | transform.Unmarshal -}} +{{- $forgejoData := dict -}} +{{- with try (resources.GetRemote $forgejoURL) -}} + {{- with .Err -}} + {{- warnf "forgejo shortcode: failed to fetch remote resource from %q: %s" $forgejoURL .Position -}} + {{- else with .Value -}} + {{- $forgejoData = . | transform.Unmarshal -}} + {{- else -}} + {{- warnf "forgejo shortcode: unable to get remote resource from %q: %s" $forgejoURL .Position -}} + {{- end -}} +{{- end -}} + {{- with $forgejoData -}}
diff --git a/layouts/shortcodes/gitea.html b/layouts/shortcodes/gitea.html index fcf0f8fb..0be6a064 100644 --- a/layouts/shortcodes/gitea.html +++ b/layouts/shortcodes/gitea.html @@ -1,6 +1,16 @@ {{ $id := delimit (slice "gitea" (partial "functions/uid.html" .)) "-" }} {{- $giteaURL := print (.Get "server" | default .Site.Params.giteaDefaultServer) "/api/v1/repos/" (.Get "repo") -}} -{{- $giteaData := resources.GetRemote $giteaURL | transform.Unmarshal -}} +{{- $giteaData := dict -}} +{{- with try (resources.GetRemote $giteaURL) -}} + {{- with .Err -}} + {{- warnf "gitea shortcode: failed to fetch remote resource from %q: %s" $giteaURL .Position -}} + {{- else with .Value -}} + {{- $giteaData = . | transform.Unmarshal -}} + {{- else -}} + {{- warnf "gitea shortcode: unable to get remote resource from %q: %s" $giteaURL .Position -}} + {{- end -}} +{{- end -}} + {{- with $giteaData -}}
diff --git a/layouts/shortcodes/github.html b/layouts/shortcodes/github.html index 05be3d4e..2ffc10f4 100644 --- a/layouts/shortcodes/github.html +++ b/layouts/shortcodes/github.html @@ -1,8 +1,17 @@ {{ $id := delimit (slice "github" (partial "functions/uid.html" .)) "-" }} {{- $githubURL := print "https://api.github.com/repos/" (.Get "repo") -}} -{{- $githubData := resources.GetRemote $githubURL | transform.Unmarshal -}} {{- $githubThumbnailURL := print "https://opengraph.githubassets.com/0/" (.Get "repo") -}} {{- $showThumbnail := .Get "showThumbnail" | default true -}} +{{- $githubData := dict -}} +{{- with try (resources.GetRemote $githubURL) -}} + {{- with .Err -}} + {{- warnf "github shortcode: failed to fetch remote resource from %q: %s" $githubURL .Position -}} + {{- else with .Value -}} + {{- $githubData = . | transform.Unmarshal -}} + {{- else -}} + {{- warnf "github shortcode: unable to get remote resource from %q: %s" $githubURL .Position -}} + {{- end -}} +{{- end -}} {{- with $githubData -}}