🐛 Ensure vendor scripts use fingerprintAlgorithm site param

Fixes: #1015
This commit is contained in:
James Panther
2025-02-24 11:09:55 +11:00
parent 1525263b74
commit 804259f5f9
2 changed files with 7 additions and 5 deletions
+1
View File
@@ -24,6 +24,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
### Fixed
- Incorrect links generated for translated content when site is in multi-host mode ([#990](https://github.com/jpanther/congo/pull/990))
- Vendor script includes do not use the `fingerprintAlgorithm` site parameter ([#1015](https://github.com/jpanther/congo/issues/1015))
- Minor documentation errors and omissions ([#985](https://github.com/jpanther/congo/pull/985), [#1005](https://github.com/jpanther/congo/pull/1005), [#1007](https://github.com/jpanther/congo/pull/1007), [#1012](https://github.com/jpanther/congo/pull/1012))
- References to deprecated `twitter` shortcodes and replaced them with `x`
+6 -5
View File
@@ -1,9 +1,10 @@
{{ $algorithm := .Site.Params.fingerprintAlgorithm | default "sha256" }}
{{/* Mermaid */}}
{{ if .Page.HasShortcode "mermaid" }}
{{ $mermaidLib := resources.Get "lib/mermaid/mermaid.min.js" }}
{{ $mermaidConfig := resources.Get "js/mermaid.js" }}
{{ $mermaidConfig := $mermaidConfig | resources.Minify }}
{{ $mermaidJS := slice $mermaidLib $mermaidConfig | resources.Concat "js/mermaid.bundle.js" | resources.Fingerprint "sha512" }}
{{ $mermaidJS := slice $mermaidLib $mermaidConfig | resources.Concat "js/mermaid.bundle.js" | resources.Fingerprint $algorithm }}
<script
defer
type="text/javascript"
@@ -16,7 +17,7 @@
{{ $chartLib := resources.Get "lib/chart/chart.umd.js" }}
{{ $chartConfig := resources.Get "js/chart.js" }}
{{ $chartConfig := $chartConfig | resources.Minify }}
{{ $chartJS := slice $chartLib $chartConfig | resources.Concat "js/chart.bundle.js" | resources.Fingerprint "sha512" }}
{{ $chartJS := slice $chartLib $chartConfig | resources.Concat "js/chart.bundle.js" | resources.Fingerprint $algorithm }}
<script
defer
type="text/javascript"
@@ -27,7 +28,7 @@
{{/* Katex */}}
{{ if .Page.HasShortcode "katex" }}
{{ $katexCSS := resources.Get "lib/katex/katex.min.css" }}
{{ $katexCSS := $katexCSS | resources.Fingerprint "sha512" }}
{{ $katexCSS := $katexCSS | resources.Fingerprint $algorithm }}
<link
type="text/css"
rel="stylesheet"
@@ -35,14 +36,14 @@
integrity="{{ $katexCSS.Data.Integrity }}"
/>
{{ $katexJS := resources.Get "lib/katex/katex.min.js" }}
{{ $katexJS := $katexJS | resources.Fingerprint "sha512" }}
{{ $katexJS := $katexJS | resources.Fingerprint $algorithm }}
<script
defer
src="{{ $katexJS.RelPermalink }}"
integrity="{{ $katexJS.Data.Integrity }}"
></script>
{{ $katexRenderJS := resources.Get "lib/katex/auto-render.min.js" }}
{{ $katexRenderJS := $katexRenderJS | resources.Fingerprint "sha512" }}
{{ $katexRenderJS := $katexRenderJS | resources.Fingerprint $algorithm }}
<script
defer
src="{{ $katexRenderJS.RelPermalink }}"