Files
HugoBlox-kit/layouts/partials/cookie_consent.html
T
thomase1993 3965252fc5 refactor: define cookie consent assets in assets.toml
Moved the Cookie Consent asset definition to assets.toml so that it's possible for offline site to use local Cookie Consent assets.

Also upgraded Cookie Consent to 3.1.1.

Close #1495
2019-12-28 20:13:15 +00:00

32 lines
1.4 KiB
HTML

{{ if site.Params.privacy_pack }}
{{ $scr := .Scratch }}
{{ $js := site.Data.assets.js }}
{{ $css := site.Data.assets.css }}
{{ if ($scr.Get "use_cdn") }}
{{ printf "<script src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\"></script>" (printf $js.cookieconsent.url $js.cookieconsent.version) $js.cookieconsent.sri | safeHTML }}
{{ printf "<link rel=\"stylesheet\" href=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\">" (printf $css.cookieconsent.url $css.cookieconsent.version) $css.cookieconsent.sri | safeHTML }}
{{ end }}
<script>
window.addEventListener("load", function(){
window.cookieconsent.initialise({
"palette": {
"popup": {
"background": "{{ $scr.Get "primary" }}",
"text": "{{ $scr.Get "background" }}"
},
"button": {
"background": "{{ $scr.Get "background" }}",
"text": "{{ $scr.Get "primary" }}"
}
},
"theme": "classic",
"content": {
"message": {{ i18n "cookie_message" | default "This website uses cookies to ensure you get the best experience on our website." }},
"dismiss": {{ i18n "cookie_dismiss" | default "Got it!" }},
"link": {{ i18n "cookie_learn" | default "Learn more" }},
"href": {{ with site.GetPage "privacy.md" }}{{ printf "%s" .RelPermalink }}{{ else }}"https://www.cookiesandyou.com"{{ end }}
}
})});
</script>
{{ end }}