From 46ae9cdea3f6d64e13ae65552e4b462beb4f51e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jelizaveta=20Leme=C5=A1eva?= Date: Mon, 14 Oct 2024 15:30:15 +0200 Subject: [PATCH] ci(sphinx): set READTHEDOCS variable in Jinja2 HTML context (#602) --- docs/conf.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/conf.py b/docs/conf.py index 7d606c52..1ad1ba6d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -33,6 +33,16 @@ # # needs_sphinx = '1.0' +# https://about.readthedocs.com/blog/2024/07/addons-by-default/ +# Define the canonical URL if you are using a custom domain on Read the Docs +html_baseurl = os.environ.get("READTHEDOCS_CANONICAL_URL", "") + +# Tell Jinja2 templates the build is running on Read the Docs +if os.environ.get("READTHEDOCS", "") == "True": + if "html_context" not in globals(): + html_context = {} + html_context["READTHEDOCS"] = True + # Do not warn on external images. suppress_warnings = ["image.nonlocal_uri"]