diff --git a/material/partials/consent.html b/material/partials/consent.html
index e909521e7..6156c60e9 100644
--- a/material/partials/consent.html
+++ b/material/partials/consent.html
@@ -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 %}
diff --git a/src/partials/consent.html b/src/partials/consent.html
index 4aad2e664..0fdad8278 100644
--- a/src/partials/consent.html
+++ b/src/partials/consent.html
@@ -20,13 +20,17 @@
IN THE SOFTWARE.
-->
-
-{% 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 %}