1
0
mirror of https://github.com/alanorth/hugo-theme-bootstrap4-blog.git synced 2024-11-17 09:47:05 +01:00

Add plumbing for cookie consent

Set the cookie_consent_info_url parameter in your site's config to
display a message about cookie usage to your users. See the config
in `exampleSite/config.toml` for more info.
This commit is contained in:
Alan Orth 2016-11-13 14:13:17 +02:00
parent 3d1526eb55
commit a66be324cc
Signed by: alanorth
GPG Key ID: 0FB860CC9C45B1B9
3 changed files with 37 additions and 0 deletions

View File

@ -21,3 +21,12 @@
- id: paginatorNext
translation: "Next page"
- id: cookieMessage
translation: "This website uses cookies."
- id: cookieLink
translation: "Learn more."
- id: cookieDismiss
translation: "Got it!"

View File

@ -19,6 +19,10 @@
{{ end }}
{{ template "_internal/google_analytics_async.html" . }}
{{ if .Site.Params.cookie_consent_info_url }}
{{ partial "cookie-consent.html" . }}
{{ end }}
</head>
<body>

View File

@ -0,0 +1,24 @@
<link href="{{ .Site.BaseURL }}css/cookieconsent.min.css" rel="stylesheet" type="text/css">
<script src="{{ .Site.BaseURL }}js/cookieconsent.min.js" 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>