{{ 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 }}
