kakawait / hugo-tranquilpeak-theme

A gorgeous responsive theme for Hugo blog framework
https://tranquilpeak.kakawait.com
GNU General Public License v3.0
919 stars 526 forks source link

Adding cookie banner #438

Open philippgaertner opened 4 years ago

philippgaertner commented 4 years ago

would it be possible to add a cookie banner assisting with General Data Protection Regulation (GDPR)? The Privacy Config settings don't seem to work.

Thanks, by the way, I love your HUGO theme.

maateen commented 4 years ago

I was about to open a feature request for the same. For the time being, I am using Cookie Consent JavaScript plugin.

You can visit this link and generate your own codes. For a quick workaround, you can copy the following codes and paste them at the end of foot_end.html of this theme.

<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/cookieconsent@3/build/cookieconsent.min.css" />
<script src="https://cdn.jsdelivr.net/npm/cookieconsent@3/build/cookieconsent.min.js" data-cfasync="false"></script>
<script>
window.cookieconsent.initialise({
  "palette": {
    "popup": {
      "background": "#252e39"
    },
    "button": {
      "background": "#14a7d0"
    }
  },
  "theme": "edgeless",
  "content": {
    "href": "https://maateen.me/privacy-policy/"
  }
});
</script>

To see a demo of this code, you may visit my blog.

@kakawait please let me know if I should contribute with a PR.

philippgaertner commented 4 years ago

Hi Maateen, this is really helpful. Following your suggestion, I was able to include a cookie consent message in my blog.