google / docsy

A set of Hugo doc templates for launching open source content.
https://docsy.dev
Apache License 2.0
2.61k stars 898 forks source link

Is there a default way to add Cookie conscent message when the website loads up for the first time? #1215

Closed Aravinda93 closed 2 years ago

Aravinda93 commented 2 years ago

Hello,

I am using the Hugo with Docsy theme to develop a simple website consisting of multiple pages. I would like to add a Coockie Conscent message which shows some message with button ok. The website does not use any coockie so I would like to show the message website does not use any coockie and a button ok.

I would like to show it only once when user opens the website and should not be displayed when user moves to different pages in the same session. Is there a out of the box approach from Docsy for the same? if not then can someone please provide some reference as I am new to Docsy and could not find something similar on the documentation.

Thanks a lot in advance.

emckean commented 2 years ago

There isn't a cookie-consent feature in Docsy, but there are some add-ons for Hugo -- check out https://discourse.gohugo.io/t/here-is-an-easy-to-install-cookie-consent-banner-for-gdpr-compliance/34411 which you may be able to modify for your needs.

Also check out the "customizing templates" section of the docs: https://www.docsy.dev/docs/adding-content/lookandfeel/#customizing-templates

Good luck!

Aravinda93 commented 2 years ago

@emckean Thanks a lot for the response. I tried the approach you have mentioned above and followed the steps mentioned in the Cookie consent | Hugo Codex. I am facing some styling issues with Cookie Consent Banner.

Ideally, I would like the banner to be visible something like this:

enter image description here

But currently its looking something like this: enter image description here

I have added it along with styles and partials. Maybe some style is messing up the child cookie consent styles but unable to figure out the same. Can you please let me know what am I doing wrong here?

I have added my complete code in following github project: https://github.com/Aravinda93/hugo-docsy-learn

I am quite new to Hugo and Docy so getting bit confused on the folder and file structure hence unable to figure out which parent style is messing up my Cookie consent modal.