From afa0e5edda3c6d8097d7364a600e58eeded08938 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Thu, 5 Nov 2026 17:16:56 +0100 Subject: feat: show the latest HardenedPass release on its landing page Read from GitHub when the site builds, so visitors contact no third party and it works without JavaScript. A failed lookup warns and leaves the line out. Co-Authored-By: Claude Opus 5.5 --- content/en/hardenedpass/_index.md | 2 ++ content/it/hardenedpass/_index.md | 2 ++ layouts/shortcodes/latest-release.html | 16 ++++++++++++++++ 3 files changed, 20 insertions(+) create mode 100644 layouts/shortcodes/latest-release.html diff --git a/content/en/hardenedpass/_index.md b/content/en/hardenedpass/_index.md index 6eae87f..9d120ea 100644 --- a/content/en/hardenedpass/_index.md +++ b/content/en/hardenedpass/_index.md @@ -19,6 +19,8 @@ original work goes to the Android Password Store authors. {{< actions url="https://github.com/danixland/HardenedPass/releases/latest" desc="Download the latest release" use="site" caption="HardenedPass is not on any app store. Get the APK from GitHub." >}} +{{< latest-release repo="danixland/HardenedPass" label="Latest release" >}} + ## What is different from upstream - Reads what modern GnuPG writes. Upstream rejected the OCB messages GnuPG 2.3 and later diff --git a/content/it/hardenedpass/_index.md b/content/it/hardenedpass/_index.md index 3934e69..2a21b72 100644 --- a/content/it/hardenedpass/_index.md +++ b/content/it/hardenedpass/_index.md @@ -19,6 +19,8 @@ lavoro originale va agli autori di Android Password Store. {{< actions url="https://github.com/danixland/HardenedPass/releases/latest" desc="Scarica l'ultima release" use="site" caption="HardenedPass non รจ su nessuno store. L'APK si scarica da GitHub." >}} +{{< latest-release repo="danixland/HardenedPass" label="Ultima release" >}} + ## Cosa cambia rispetto a upstream - Legge quello che scrive il GnuPG moderno. Upstream rifiutava i messaggi OCB che GnuPG 2.3 e diff --git a/layouts/shortcodes/latest-release.html b/layouts/shortcodes/latest-release.html new file mode 100644 index 0000000..33389c7 --- /dev/null +++ b/layouts/shortcodes/latest-release.html @@ -0,0 +1,16 @@ +{{- /* + The latest release of a GitHub repository, read when the site builds so visitors never contact + GitHub. Params: repo (owner/name), label. Prints nothing if GitHub cannot be reached. + The key changes on every build: GetRemote's cache never expires by default. + ponytail: each build leaves one small file in Hugo's cache; `hugo --gc` if that ever matters. +*/ -}} +{{- $url := printf "https://api.github.com/repos/%s/releases/latest" (.Get "repo") -}} +{{- with try (resources.GetRemote $url (dict "key" now.Unix)) -}} + {{- with .Err -}} + {{- warnf "latest-release: %s" . -}} + {{- else with .Value -}} + {{- with (. | transform.Unmarshal).tag_name -}} +

{{ $.Get "label" }}: {{ strings.TrimPrefix "v" . }}

+ {{- end -}} + {{- end -}} +{{- end -}} -- cgit v1.2.3