diff --git a/_templates/page.html b/_templates/page.html
index 33ae2d56a..d1c9a515a 100644
--- a/_templates/page.html
+++ b/_templates/page.html
@@ -2,7 +2,7 @@
{% block extrahead %}
{{ super() }}
-{% if not READTHEDOCS %}
+{% if not is_deployment_preview %}
{% endif %}
{% endblock %}
diff --git a/conf.py b/conf.py
index 7c0dae346..cd846dd04 100644
--- a/conf.py
+++ b/conf.py
@@ -52,8 +52,12 @@
# Set to '' to prevent appending "documentation" to the site title
html_title = ""
+# Deployment preview information
+# (See .readthedocs.yaml and https://docs.readthedocs.io/en/stable/reference/environment-variables.html)
+is_deployment_preview = os.getenv("READTHEDOCS_VERSION_TYPE") == "external"
+
html_context = {
- "READTHEDOCS": bool(os.getenv("READTHEDOCS")),
+ "is_deployment_preview": is_deployment_preview,
}
linkcheck_allowed_redirects = {