mirror of
https://github.com/alanorth/hugo-theme-bootstrap4-blog.git
synced 2024-11-17 17:57:04 +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:
parent
3d1526eb55
commit
a66be324cc
@ -21,3 +21,12 @@
|
|||||||
|
|
||||||
- id: paginatorNext
|
- id: paginatorNext
|
||||||
translation: "Next page"
|
translation: "Next page"
|
||||||
|
|
||||||
|
- id: cookieMessage
|
||||||
|
translation: "This website uses cookies."
|
||||||
|
|
||||||
|
- id: cookieLink
|
||||||
|
translation: "Learn more."
|
||||||
|
|
||||||
|
- id: cookieDismiss
|
||||||
|
translation: "Got it!"
|
||||||
|
@ -19,6 +19,10 @@
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ template "_internal/google_analytics_async.html" . }}
|
{{ template "_internal/google_analytics_async.html" . }}
|
||||||
|
|
||||||
|
{{ if .Site.Params.cookie_consent_info_url }}
|
||||||
|
{{ partial "cookie-consent.html" . }}
|
||||||
|
{{ end }}
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
24
layouts/partials/cookie-consent.html
Normal file
24
layouts/partials/cookie-consent.html
Normal 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>
|
Loading…
Reference in New Issue
Block a user