From 9e99493e696961bf6dfd58c8540184c8ad4132f7 Mon Sep 17 00:00:00 2001 From: John <44279692+hlwjia@users.noreply.github.com> Date: Tue, 26 Jan 2021 00:08:10 +0800 Subject: [PATCH] Use md5 instead of default sha256 for generating SRI hashes (#195) reference: https://gohugo.io/hugo-pipes/fingerprint/ --- layouts/partials/footer.html | 2 +- layouts/partials/head.html | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 276a76af..454c091d 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -20,7 +20,7 @@ {{- $isHLJSdisabled := (.Site.Params.assets.disableHLJS | default .Params.disableHLJS ) }} {{- if (and (eq .Kind "page") (ne .Layout "archives") (ne .Layout "search") (not $isHLJSdisabled)) }} {{- if not .Site.Params.assets.disableFingerprinting }} -{{- $highlight := slice (resources.Get "js/highlight.min.js") | resources.Concat "assets/js/highlight.js" | minify | fingerprint }} +{{- $highlight := slice (resources.Get "js/highlight.min.js") | resources.Concat "assets/js/highlight.js" | minify | resources.Fingerprint "md5" }} {{- else}} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 86e13f55..416aa784 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -31,7 +31,7 @@ {{- $stylesheet := (slice $common $extended) | resources.Concat "assets/css/stylesheet.css" | minify }} {{- if not .Site.Params.assets.disableFingerprinting }} -{{- $stylesheet := $stylesheet | fingerprint -}} +{{- $stylesheet := $stylesheet | resources.Fingerprint "md5" -}} {{- else}} @@ -43,7 +43,7 @@ {{- $fastsearch := resources.Get "js/fastsearch.js" | resources.ExecuteAsTemplate "js/fastsearch.js" .Site.Params.fuseOpts }} {{- $fusejs := resources.Get "js/fuse.js" }} {{- if not .Site.Params.assets.disableFingerprinting }} -{{- $search := (slice $fusejs $fastsearch ) | resources.Concat "assets/js/search.js" | minify | fingerprint }} +{{- $search := (slice $fusejs $fastsearch ) | resources.Concat "assets/js/search.js" | minify | resources.Fingerprint "md5" }} {{- else}} {{ $search := (slice $fusejs $fastsearch ) | resources.Concat "assets/js/search.js" | minify }}