Skip to content

Commit c70035a

Browse files
Add Plausible analytics (#1749)
1 parent 16c670e commit c70035a

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

_templates/page.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{% extends "!page.html" %}
2+
3+
{% block extrahead %}
4+
{{ super() }}
5+
{% if not READTHEDOCS %}
6+
<script defer data-domain="devguide.python.org" src="https://analytics.python.org/js/script.outbound-links.js"></script>
7+
{% endif %}
8+
{% endblock %}

conf.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import json
2+
import os
23
from urllib.request import urlopen
34

45
extensions = [
@@ -37,6 +38,7 @@
3738
"source_repository": "https://github.com/python/devguide",
3839
"source_branch": "main",
3940
}
41+
templates_path = ['_templates']
4042
html_static_path = ['_static']
4143
html_css_files = [
4244
'devguide_overrides.css',
@@ -50,6 +52,10 @@
5052
# Set to '' to prevent appending "documentation" to the site title
5153
html_title = ""
5254

55+
html_context = {
56+
"READTHEDOCS": bool(os.getenv("READTHEDOCS")),
57+
}
58+
5359
linkcheck_allowed_redirects = {
5460
# Edit page
5561
r"https://docs.google.com/document/d/.*/": r"https://docs.google.com/document/d/.*/edit", # noqa: E501

0 commit comments

Comments
 (0)