From 9504b90c9aac391f9f5873d557749611d3ad1768 Mon Sep 17 00:00:00 2001
From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Date: Wed, 29 May 2024 17:03:29 +0300
Subject: [PATCH 1/4] Add Plausible for docs metrics
---
Doc/tools/templates/layout.html | 3 +++
1 file changed, 3 insertions(+)
diff --git a/Doc/tools/templates/layout.html b/Doc/tools/templates/layout.html
index 3f88fc8e91faad..48b8046fc3af67 100644
--- a/Doc/tools/templates/layout.html
+++ b/Doc/tools/templates/layout.html
@@ -26,6 +26,9 @@
{% endblock %}
{% block extrahead %}
+ {% if builder == "html" %}
+
+ {% endif %}
{% if builder != "htmlhelp" %}
{% if pagename == 'whatsnew/changelog' and not embedded %}
From e76d2901b89f231b9ccbe0ca1fd8ce61f18c00f9 Mon Sep 17 00:00:00 2001
From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Date: Mon, 3 Jun 2024 15:24:30 +0300
Subject: [PATCH 2/4] Use main python.org domain
---
Doc/tools/templates/layout.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Doc/tools/templates/layout.html b/Doc/tools/templates/layout.html
index 48b8046fc3af67..3cb8200976caaa 100644
--- a/Doc/tools/templates/layout.html
+++ b/Doc/tools/templates/layout.html
@@ -27,7 +27,7 @@
{% block extrahead %}
{% if builder == "html" %}
-
+
{% endif %}
{% if builder != "htmlhelp" %}
From 7cbadb00272e9355c7b5d0948150244d55629022 Mon Sep 17 00:00:00 2001
From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Date: Mon, 3 Jun 2024 15:51:18 +0300
Subject: [PATCH 3/4] Revert "Use main python.org domain"
This reverts commit e76d2901b89f231b9ccbe0ca1fd8ce61f18c00f9.
---
Doc/tools/templates/layout.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Doc/tools/templates/layout.html b/Doc/tools/templates/layout.html
index 3cb8200976caaa..48b8046fc3af67 100644
--- a/Doc/tools/templates/layout.html
+++ b/Doc/tools/templates/layout.html
@@ -27,7 +27,7 @@
{% block extrahead %}
{% if builder == "html" %}
-
+
{% endif %}
{% if builder != "htmlhelp" %}
From 8a3dd7469d029eacc21b2c7a256088f9a082d942 Mon Sep 17 00:00:00 2001
From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Date: Thu, 6 Jun 2024 23:35:59 +0300
Subject: [PATCH 4/4] Add env var to enable analytics
Co-authored-by: Julien Palard
---
Doc/conf.py | 3 ++-
Doc/tools/templates/layout.html | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/Doc/conf.py b/Doc/conf.py
index 47fb96fe1de482..8a14646801ebac 100644
--- a/Doc/conf.py
+++ b/Doc/conf.py
@@ -339,7 +339,8 @@
html_context = {
"is_deployment_preview": os.getenv("READTHEDOCS_VERSION_TYPE") == "external",
"repository_url": repository_url.removesuffix(".git") if repository_url else None,
- "pr_id": os.getenv("READTHEDOCS_VERSION")
+ "pr_id": os.getenv("READTHEDOCS_VERSION"),
+ "enable_analytics": os.getenv("PYTHON_DOCS_ENABLE_ANALYTICS"),
}
# This 'Last updated on:' timestamp is inserted at the bottom of every page.
diff --git a/Doc/tools/templates/layout.html b/Doc/tools/templates/layout.html
index 48b8046fc3af67..b09fd21a8ddcc9 100644
--- a/Doc/tools/templates/layout.html
+++ b/Doc/tools/templates/layout.html
@@ -26,7 +26,7 @@
{% endblock %}
{% block extrahead %}
- {% if builder == "html" %}
+ {% if builder == "html" and enable_analytics %}
{% endif %}