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 This file was automatically generated - do not edit
-#} -#}
{% set cookies = config.extra.consent.cookies %} {% set cookies = config.extra.consent.cookies | d({}) %}
{% if config.extra.analytics and not cookies %} {% if config.extra.analytics %}
{% set cookies = { "analytics": "Google Analytics" } %} {% if "analytics" not in cookies %}
{% set _ = cookies.update({ "analytics": "Google Analytics" }) %}
{% endif %}
{% endif %} {% endif %}
{% if "github.com" in config.repo_url and "github" not in cookies %} {% if "github.com" in config.repo_url %}
{% set _ = cookies.update({ "github": "GitHub" }) %} {% if "github" not in cookies %}
{% set _ = cookies.update({ "github": "GitHub" }) %}
{% endif %}
{% endif %} {% endif %}
{% set actions = config.extra.consent.actions %} {% set actions = config.extra.consent.actions %}
{% if not actions %} {% if not actions %}

View File

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