Fixed cookie consent when analytics was not set

This commit is contained in:
squidfunk 2022-09-20 13:39:12 +02:00
parent 1f0578849c
commit c7deb06b79
2 changed files with 19 additions and 11 deletions

View File

@ -1,12 +1,16 @@
{#-
This file was automatically generated - do not edit
-#}
{% set cookies = config.extra.consent.cookies %}
{% if config.extra.analytics and not cookies %}
{% set cookies = { "analytics": "Google Analytics" } %}
{% set cookies = config.extra.consent.cookies | d({}) %}
{% if config.extra.analytics %}
{% if "analytics" not in cookies %}
{% set _ = cookies.update({ "analytics": "Google Analytics" }) %}
{% endif %}
{% endif %}
{% if "github.com" in config.repo_url and "github" not in cookies %}
{% set _ = cookies.update({ "github": "GitHub" }) %}
{% if "github.com" in config.repo_url %}
{% if "github" not in cookies %}
{% set _ = cookies.update({ "github": "GitHub" }) %}
{% endif %}
{% endif %}
{% set actions = config.extra.consent.actions %}
{% if not actions %}

View File

@ -20,13 +20,17 @@
IN THE SOFTWARE.
-->
<!-- Determine cookies (default to analytics, if present) -->
{% set cookies = config.extra.consent.cookies %}
{% if config.extra.analytics and not cookies %}
{% set cookies = { "analytics": "Google Analytics" } %}
<!-- Determine cookies -->
{% set cookies = config.extra.consent.cookies | d({}) %}
{% if config.extra.analytics %}
{% if "analytics" not in cookies %}
{% set _ = cookies.update({ "analytics": "Google Analytics" }) %}
{% endif %}
{% endif %}
{% if "github.com" in config.repo_url and "github" not in cookies %}
{% set _ = cookies.update({ "github": "GitHub" }) %}
{% if "github.com" in config.repo_url %}
{% if "github" not in cookies %}
{% set _ = cookies.update({ "github": "GitHub" }) %}
{% endif %}
{% endif %}
<!-- Determine actions -->