Jekyll: Cookie Consent
Date
09.11.2016Reading time
1 MinutesComments
0 commentsTags
- jekyll
The EU decided, that every website should give a clear warning if it is using cookies in it’s EU ePrivacy Directive. Due to some local laws, it’s not clear if you need a Cookie Warning in Germany, but just to be sure I prefer to add a simple version.
Include Cookie Consent
You can find many a quite nice Cookie Constent solutions, I picked Insites' Cookie Consent which is licensed under MIT license.
On their website you can even configure the solution through a simple wizard: Download Cookie Consent
If you are using the minima theme, there is currently no option to simply include additional Javascript. Therefor you have to create _includes/head.html and paste the content of the original head.html.
Now you can add {{ "{% include cookieconsent.html "}} %} before the closing head tag. This will include the content of _includes/cookieconsent.html which you have to create with the content provided by the wizard.
For example:
<link
rel="stylesheet"
type="text/css"
href="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.0.2/cookieconsent.min.css"
/>
<script
async
defer
src="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.0.2/cookieconsent.min.js"
></script>
<script>
window.addEventListener("load", function() {
window.cookieconsent.initialise({
palette: {
popup: {
background: "#424242"
},
button: {
background: "#2a7ae2"
}
},
content: {
href: "https://www.dev-eth0.de/privacy-policy"
}
});
});
</script>
Comments