Skip to content

Commit 9537d3d

Browse files
authored
Enable Plausible for RTD but not RTD previews (#1751)
1 parent ae7f8bc commit 9537d3d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

_templates/page.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
{% block extrahead %}
44
{{ super() }}
5-
{% if not READTHEDOCS %}
5+
{% if not is_deployment_preview %}
66
<script defer data-domain="devguide.python.org" src="https://analytics.python.org/js/script.outbound-links.js"></script>
77
{% endif %}
88
{% endblock %}

conf.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,12 @@
5252
# Set to '' to prevent appending "documentation" to the site title
5353
html_title = ""
5454

55+
# Deployment preview information
56+
# (See .readthedocs.yaml and https://docs.readthedocs.io/en/stable/reference/environment-variables.html)
57+
is_deployment_preview = os.getenv("READTHEDOCS_VERSION_TYPE") == "external"
58+
5559
html_context = {
56-
"READTHEDOCS": bool(os.getenv("READTHEDOCS")),
60+
"is_deployment_preview": is_deployment_preview,
5761
}
5862

5963
linkcheck_allowed_redirects = {

0 commit comments

Comments
 (0)