diff --git a/material/partials/consent.html b/material/partials/consent.html
index 6156c60e9..afb7038f6 100644
--- a/material/partials/consent.html
+++ b/material/partials/consent.html
@@ -7,7 +7,7 @@
{% set _ = cookies.update({ "analytics": "Google Analytics" }) %}
{% endif %}
{% endif %}
-{% if "github.com" in config.repo_url %}
+{% if config.repo_url and "github.com" in config.repo_url %}
{% if "github" not in cookies %}
{% set _ = cookies.update({ "github": "GitHub" }) %}
{% endif %}
diff --git a/src/partials/consent.html b/src/partials/consent.html
index 0fdad8278..9f1a35ed3 100644
--- a/src/partials/consent.html
+++ b/src/partials/consent.html
@@ -27,7 +27,7 @@
{% set _ = cookies.update({ "analytics": "Google Analytics" }) %}
{% endif %}
{% endif %}
-{% if "github.com" in config.repo_url %}
+{% if config.repo_url and "github.com" in config.repo_url %}
{% if "github" not in cookies %}
{% set _ = cookies.update({ "github": "GitHub" }) %}
{% endif %}