1
0
mirror of https://github.com/alanorth/hugo-theme-bootstrap4-blog.git synced 2024-12-18 16:42:21 +01:00

layouts/_default/baseof.html: Allow disabling of SRI

Some sites using edge caching like that on a CDN or S3 might have
issues with assets being cached too long, causing user agents to
refuse to load assets due to SRI hash mismatch. These sites should
disable the use of sub-resource integrity hashes using this config
option in their config:

    disable_sri = true
This commit is contained in:
Alan Orth 2017-04-12 21:38:10 +03:00
parent dc0201301b
commit a81ed6803b
Signed by: alanorth
GPG Key ID: 0FB860CC9C45B1B9
2 changed files with 3 additions and 3 deletions

View File

@ -13,7 +13,7 @@
<title>{{ block "title" . }}{{ .Site.Title }}{{ end }}</title>
{{ "<!-- combined, minified CSS -->" | safeHTML }}
<link href="{{ .Site.BaseURL }}css/style.css" rel="stylesheet" integrity="{{ .Site.Data.sri.style}}" crossorigin="anonymous">
<link href="{{ .Site.BaseURL }}css/style.css" rel="stylesheet"{{ if not .Site.Params.disable_sri }} integrity="{{ .Site.Data.sri.style}}" crossorigin="anonymous"{{ end }}>
{{ if .RSSLink }}
{{ "<!-- RSS 2.0 feed -->" | safeHTML }}

View File

@ -1,5 +1,5 @@
<link href="{{ .Site.BaseURL }}css/cookieconsent.min.css" rel="stylesheet" type="text/css" integrity="{{ .Site.Data.sri.cookieconsentcss }}" crossorigin="anonymous">
<script src="{{ .Site.BaseURL }}js/cookieconsent.min.js" integrity="{{ .Site.Data.sri.cookieconsentjs }}" crossorigin="anonymous" async></script>
<link href="{{ .Site.BaseURL }}css/cookieconsent.min.css" rel="stylesheet" type="text/css"{{ if not .Site.Params.disable_sri }} integrity="{{ .Site.Data.sri.cookieconsentcss }}" crossorigin="anonymous"{{ end }}>
<script src="{{ .Site.BaseURL }}js/cookieconsent.min.js"{{ if not .Site.Params.disable_sri }} integrity="{{ .Site.Data.sri.cookieconsentjs }}" crossorigin="anonymous"{{ end }} async></script>
<script>
window.addEventListener("load", function(){