cookie_consent.html 1.4 KB

12345678910111213141516171819202122232425262728293031
  1. {{ if site.Params.features.privacy_pack.enable }}
  2. {{ $scr := .Scratch }}
  3. {{ $js := site.Data.assets.js }}
  4. {{ $css := site.Data.assets.css }}
  5. {{ if ($scr.Get "use_cdn") }}
  6. {{ printf "<script src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\"></script>" (printf $js.cookieconsent.url $js.cookieconsent.version) $js.cookieconsent.sri | safeHTML }}
  7. {{ printf "<link rel=\"stylesheet\" href=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\">" (printf $css.cookieconsent.url $css.cookieconsent.version) $css.cookieconsent.sri | safeHTML }}
  8. {{ end }}
  9. <script>
  10. window.addEventListener("load", function(){
  11. window.cookieconsent.initialise({
  12. "palette": {
  13. "popup": {
  14. "background": "{{ $scr.Get "primary" }}",
  15. "text": "{{ $scr.Get "background" }}"
  16. },
  17. "button": {
  18. "background": "{{ $scr.Get "background" }}",
  19. "text": "{{ $scr.Get "primary" }}"
  20. }
  21. },
  22. "theme": "classic",
  23. "content": {
  24. "message": {{ i18n "cookie_message" | default "This website uses cookies to ensure you get the best experience on our website." }},
  25. "dismiss": {{ i18n "cookie_dismiss" | default "Got it!" }},
  26. "link": {{ i18n "cookie_learn" | default "Learn more" }},
  27. "href": {{ with site.GetPage "privacy.md" }}{{ printf "%s" .RelPermalink }}{{ else }}"https://www.cookiesandyou.com"{{ end }}
  28. }
  29. })});
  30. </script>
  31. {{ end }}