Skip to content

Commit c7deb06

Browse files
committed
Fixed cookie consent when analytics was not set
1 parent 1f05788 commit c7deb06

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

material/partials/consent.html

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
{#-
22
This file was automatically generated - do not edit
33
-#}
4-
{% set cookies = config.extra.consent.cookies %}
5-
{% if config.extra.analytics and not cookies %}
6-
{% set cookies = { "analytics": "Google Analytics" } %}
4+
{% set cookies = config.extra.consent.cookies | d({}) %}
5+
{% if config.extra.analytics %}
6+
{% if "analytics" not in cookies %}
7+
{% set _ = cookies.update({ "analytics": "Google Analytics" }) %}
8+
{% endif %}
79
{% endif %}
8-
{% if "github.com" in config.repo_url and "github" not in cookies %}
9-
{% set _ = cookies.update({ "github": "GitHub" }) %}
10+
{% if "github.com" in config.repo_url %}
11+
{% if "github" not in cookies %}
12+
{% set _ = cookies.update({ "github": "GitHub" }) %}
13+
{% endif %}
1014
{% endif %}
1115
{% set actions = config.extra.consent.actions %}
1216
{% if not actions %}

src/partials/consent.html

+10-6
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,17 @@
2020
IN THE SOFTWARE.
2121
-->
2222

23-
<!-- Determine cookies (default to analytics, if present) -->
24-
{% set cookies = config.extra.consent.cookies %}
25-
{% if config.extra.analytics and not cookies %}
26-
{% set cookies = { "analytics": "Google Analytics" } %}
23+
<!-- Determine cookies -->
24+
{% set cookies = config.extra.consent.cookies | d({}) %}
25+
{% if config.extra.analytics %}
26+
{% if "analytics" not in cookies %}
27+
{% set _ = cookies.update({ "analytics": "Google Analytics" }) %}
28+
{% endif %}
2729
{% endif %}
28-
{% if "github.com" in config.repo_url and "github" not in cookies %}
29-
{% set _ = cookies.update({ "github": "GitHub" }) %}
30+
{% if "github.com" in config.repo_url %}
31+
{% if "github" not in cookies %}
32+
{% set _ = cookies.update({ "github": "GitHub" }) %}
33+
{% endif %}
3034
{% endif %}
3135

3236
<!-- Determine actions -->

0 commit comments

Comments
 (0)