fix: wrong SRI hash for katex.css (#702)

* Correct URL given in 'dev.toml'

* stylesheet 'katex.css': fix SRI hash
This commit is contained in:
Andreas Deininger
2025-06-11 00:48:03 +02:00
committed by GitHub
parent 9c2a9f600b
commit b43870a538
2 changed files with 4 additions and 3 deletions

View File

@ -1,5 +1,5 @@
# Theme development config for exampleSite
# https://gohugo.io/getting-started/configuration/#configure-cache-busters
# https://gohugo.io/configuration/build/#cache-busters
[build]
[build.buildStats]
enable = true

View File

@ -95,10 +95,11 @@
{{ with try (resources.GetRemote $katexCssUrl) -}}
{{ with .Err -}}
{{ errorf "Could not retrieve KaTeX css file from %s. Reason: %s." $katexCssUrl . -}}
{{ else with.Value -}}
{{ else with .Value -}}
{{ $katexCssContent := strings.Replace .Content $katexFontPattern $katexFontSubstituted }}
{{ with resources.FromString (printf "css/katex%s.css" (cond hugo.IsProduction ".min" "")) $katexCssContent -}}
<link rel="stylesheet" href="{{- .RelPermalink -}}" integrity="{{- . | fingerprint -}}" crossorigin="anonymous" />
{{ $cssHash := . | fingerprint "sha512" -}}
<link rel="stylesheet" href="{{- .RelPermalink -}}" integrity="{{- $cssHash.Data.Integrity -}}" crossorigin="anonymous" />
{{ end -}}
{{ end -}}
{{ end -}}