Skip to content

Commit b736a3f

Browse files
authored
Add settings that used to be automatically injected by RTD (#15)
Following the advice in [1], add code to the configuration file that readthedocs used to inject automatically but will no longer. [1] https://about.readthedocs.com/blog/2024/07/addons-by-default/
1 parent 3d204b1 commit b736a3f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

conf.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@
1818
# -- General configuration ---------------------------------------------------
1919
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
2020

21+
22+
# Define the canonical URL if you are using a custom domain on Read the Docs
23+
import os
24+
html_baseurl = os.environ.get("READTHEDOCS_CANONICAL_URL", "")
25+
26+
# Tell Jinja2 templates the build is running on Read the Docs
27+
if os.environ.get("READTHEDOCS", "") == "True":
28+
if "html_context" not in globals():
29+
html_context = {}
30+
html_context["READTHEDOCS"] = True
31+
2132
# Add any Sphinx extension module names here, as strings. They can be
2233
# extensions coming with Sphinx (named "sphinx.ext.*") or your custom
2334
# ones.

0 commit comments

Comments
 (0)