From b1c5584679b9a85a4281d0a2eb1952caf89738d4 Mon Sep 17 00:00:00 2001 From: Rohan Kumar Date: Tue, 30 Jan 2024 18:02:00 -0500 Subject: [PATCH] Fingerprint webmanifest with FNV32a instead of md5 --- layouts/partials/head.html | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 3e1536b..496f58b 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -19,8 +19,12 @@ - {{ $webmanifest := resources.Get "/manifest.webmanifest" | resources.ExecuteAsTemplate "manifest.webmanifest" . | resources.Minify | resources.Fingerprint "md5" -}} - {{- printf `` $webmanifest.RelPermalink | safeHTML -}} + {{ $webmanifest := resources.Get "/manifest.webmanifest" | resources.ExecuteAsTemplate "manifest.webmanifest" . | resources.Minify -}} + {{- $cacheBuster := $webmanifest.Content | crypto.FNV32a -}} + {{- $webmanifestFingerprinted := printf "/manifest.%d.webmanifest" $cacheBuster -}} + {{- with resources.Copy $webmanifestFingerprinted $webmanifest -}} + {{- printf `` .RelPermalink | safeHTML -}} + {{- end -}} {{- if or (eq .Section "notes") (eq .Title "Notes") -}}