mirror of
https://github.com/alanorth/hugo-theme-bootstrap4-blog.git
synced 2024-12-19 00:52:19 +01:00
We can use Hugo's built-in SRI support instead of using our custom SRI generator script (as cool as it was at the time). This is more clean and gives us the added benefit of adding fingerprints to the CSS and JS filenames, which acts as a cache buster. See: https://gohugo.io/hugo-pipes/introduction/ See: https://github.com/alanorth/hugo-theme-bootstrap4-blog/issues/120
29 lines
1.1 KiB
HTML
29 lines
1.1 KiB
HTML
{{ $cookieConsentStyle := resources.Get "css/cookieconsent.min.css" | resources.Fingerprint }}
|
|
<link href="{{ $cookieConsentStyle.Permalink }}" rel="stylesheet" type="text/css"{{ if not .Site.Params.disable_sri }} integrity="{{ $cookieConsentStyle.Data.Integrity }}" crossorigin="anonymous"{{ end }}>
|
|
{{ $cookieConsentScript := resources.Get "js/cookieconsent.min.js" | resources.Fingerprint }}
|
|
<script src="{{ $cookieConsentScript.Permalink }}"{{ if not .Site.Params.disable_sri }} integrity="{{ $cookieConsentScript.Data.Integrity }}" crossorigin="anonymous"{{ end }} async></script>
|
|
|
|
<script>
|
|
window.addEventListener("load", function(){
|
|
window.cookieconsent.initialise({
|
|
"palette": {
|
|
"popup": {
|
|
"background": "#428bca",
|
|
"text": "#ffffff"
|
|
},
|
|
"button": {
|
|
"background": "#f71559"
|
|
}
|
|
},
|
|
"content": {
|
|
"message": '{{ i18n "cookieMessage" }}',
|
|
"dismiss": '{{ i18n "cookieDismiss" }}',
|
|
"link": '{{ i18n "cookieLink" }}',
|
|
"href": "{{ .Site.Params.cookie_consent_info_url | absURL}}"
|
|
},
|
|
"position": "bottom-right"
|
|
})});
|
|
</script>
|
|
|
|
{{- /* vim: set ts=2 sw=2 et: */}}
|