We want to solve a pop-up or a so-called "header info" about the cookie plugin "Cookies". We have assigned and created the cookie accordingly. It appears as soon as we set (initial set) a cookie via globals or change the text of "globalheaderinfo.headerInfo".
Actual state: The cookie appears as soon as it is set or the text is changed. But as soon as I switch from the Home e.g. to the Contact page (by clicking on Contact page in the navigation) the cookie disappears.
Target state: The cookie must not be closed until I have clicked on the Close button.
Craft-Version: 3.7.28
Cookies-Plugin-Version: 1.1.15
Here our Code:
{% if getCookie('Header') %}
{% set checkCookieHeader = getCookie('Header') %}
{% if checkCookieHeader != globalheaderinfo.headerInfo %}
<div class="header-info">
{{ globalheaderinfo.headerInfo }}
</div>
{% do 'Header' | setCookie( globalheaderinfo.headerInfo, now | date_modify("+1 year").timestamp) %}
{% endif %}
{% else %}
{% set checkCookieHeader = getCookie('Header') %}
<div class="header-info">
{{ globalheaderinfo.headerInfo }}
</div>
{% do setCookie('Header', globalheaderinfo.headerInfo, now | date_modify("+1 year").timestamp) %}
{% endif %}