hugo-bearblog : add option to diable integrity using papermod's solution
This commit is contained in:
parent
b46dab5ba6
commit
1c1dd34eb2
@ -50,3 +50,8 @@ ignoreErrors = ["error-disable-taxonomy"]
|
||||
# for details. An example TOML config that uses [ISO
|
||||
# 8601](https://en.wikipedia.org/wiki/ISO_8601) format:
|
||||
# dateFormat = "2006-01-02"
|
||||
|
||||
# based on solutions by papermod : https://github.com/adityatelange/hugo-PaperMod/issues/89
|
||||
# disable integrity on script,stylesheet linking
|
||||
[params.assets]
|
||||
# disableFingerprinting = true
|
||||
|
@ -15,13 +15,24 @@
|
||||
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
|
||||
{{ end -}}
|
||||
|
||||
<!-- External Script, Stylesheet linking -->
|
||||
{{- /* CSS stylesheet */}}
|
||||
{{- $stylesheet := (resources.Get "css/style.css") | resources.Minify | fingerprint }}
|
||||
{{- $stylesheet := (resources.Get "css/style.css") | resources.Minify }}
|
||||
{{- if not site.Params.assets.disableFingerprinting }}
|
||||
{{- $stylesheet := $stylesheet | fingerprint }}
|
||||
<link crossorigin="anonymous" href="{{ $stylesheet.RelPermalink }}" integrity="{{ $stylesheet.Data.Integrity }}" rel="preload stylesheet" as="style">
|
||||
{{ else }}
|
||||
<link crossorigin="anonymous" href="{{ $stylesheet.RelPermalink }}" rel="preload stylesheet" as="style">
|
||||
{{ end }}
|
||||
|
||||
{{- /* Javascript */}}
|
||||
{{- $darkmode_script := (resources.Get "js/darkmode.js") | resources.Minify | fingerprint}}
|
||||
<script defer crossorigin="anonymous" src="{{ $darkmode_script.RelPermalink }}" integrity="{{ $darkmode_script.Data.Integrity }}" async></script>
|
||||
{{- $darkmode_script := (resources.Get "js/darkmode.js") | resources.Minify }}
|
||||
{{- if not site.Params.assets.disableFingerprinting }}
|
||||
{{- $darkmode_script := $darkmode_script | fingerprint }}
|
||||
<script async crossorigin="anonymous" src="{{ $darkmode_script.RelPermalink }}" integrity="{{ $darkmode_script.Data.Integrity }}"></script>
|
||||
{{ else }}
|
||||
<script async crossorigin="anonymous" src="{{ $darkmode_script.RelPermalink }}"></script>
|
||||
{{ end }}
|
||||
|
||||
<!-- A partial to be overwritten by the user.
|
||||
Simply place a custom_head.html into
|
||||
@ -41,8 +52,13 @@
|
||||
</footer>
|
||||
|
||||
{{- /* Bottom Javascript */}}
|
||||
{{- $darkmode_load_script := (resources.Get "js/darkmode_load.js") | resources.Minify | fingerprint}}
|
||||
<script defer crossorigin="anonymous" src="{{ $darkmode_load_script.RelPermalink }}" integrity="{{ $darkmode_load_script.Data.Integrity }}"></script>
|
||||
{{- $darkmode_load_script := (resources.Get "js/darkmode_load.js") | resources.Minify}}
|
||||
{{- if not site.Params.assets.disableFingerprinting }}
|
||||
{{- $darkmode_load_script := $darkmode_load_script | fingerprint }}
|
||||
<script async crossorigin="anonymous" src="{{ $darkmode_load_script.RelPermalink }}" integrity="{{ $darkmode_load_script.Data.Integrity }}"></script>
|
||||
{{ else }}
|
||||
<script async crossorigin="anonymous" src="{{ $darkmode_load_script.RelPermalink }}"></script>
|
||||
{{ end }}
|
||||
|
||||
<!-- A partial to be overwritten by the user.
|
||||
Simply place a custom_body.html into
|
||||
|
@ -28,9 +28,13 @@
|
||||
</ul>
|
||||
|
||||
{{- /* Random Color Script */}}
|
||||
{{- $random_color_script := (resources.Get "js/random_color.js") | resources.Minify | fingerprint}}
|
||||
<script defer crossorigin="anonymous" src="{{ $random_color_script.RelPermalink }}" integrity="{{ $random_color_script.Data.Integrity }}" async></script>
|
||||
|
||||
{{- $random_color_script := (resources.Get "js/random_color.js") | resources.Minify }}
|
||||
{{- if not site.Params.assets.disableFingerprinting }}
|
||||
{{- $random_color_script := $random_color_script | fingerprint }}
|
||||
<script async crossorigin="anonymous" src="{{ $random_color_script.RelPermalink }}" integrity="{{ $random_color_script.Data.Integrity }}"></script>
|
||||
{{ else }}
|
||||
<script async crossorigin="anonymous" src="{{ $random_color_script.RelPermalink }}"></script>
|
||||
{{ end }}
|
||||
|
||||
{{ if .Data.Singular }}
|
||||
{{else}}
|
||||
|
Loading…
Reference in New Issue
Block a user