Skip to content

Commit 501a5bc

Browse files
authored
Add missing integrity attributes (luizdepra#520)
* Verify minified dark-mode.js integrity * Verify forkawesome-webfont.woff2 integrity * Use pipes to fingerprint forkawesome-webfont.woff2
1 parent 36514f2 commit 501a5bc

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

layouts/_default/baseof.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
<link rel="canonical" href="{{ .Permalink }}">
2323
{{ end }}
2424

25-
<link rel="preload" href="/fonts/forkawesome-webfont.woff2?v=1.1.7" as="font" type="font/woff2" crossorigin>
25+
{{ $fa := resources.Get "fonts/forkawesome-webfont.woff2" }}
26+
{{ $faFingerprint := $fa | fingerprint }}
27+
<link rel="preload" href="{{ $fa.RelPermalink }}?v=1.1.7" as="font" type="font/woff2" integrity="{{ $faFingerprint.Data.Integrity }}" crossorigin>
2628

2729
{{ if .Site.IsServer }}
2830
{{ $cssOpts := (dict "targetPath" "css/coder.css" "enableSourceMap" true ) }}
@@ -118,7 +120,7 @@
118120
<script src="{{ $script.RelPermalink }}"></script>
119121
{{ else }}
120122
{{ $script := resources.Get "js/dark-mode.js" | minify | fingerprint }}
121-
<script src="{{ $script.RelPermalink }}"></script>
123+
<script src="{{ $script.RelPermalink }}" integrity="{{ $script.Data.Integrity }}"></script>
122124
{{ end }}
123125
{{ end }}
124126

0 commit comments

Comments
 (0)