From 4ff23f597406e42088ac510e52281b9693ee599a Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 7 Oct 2024 13:33:03 +0200 Subject: [PATCH] RTD updates (#2240) Re https://about.readthedocs.com/blog/2024/07/addons-by-default/ Co-authored-by: Sasha Romijn --- docs/conf.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/conf.py b/docs/conf.py index c7882b33b..3dfbbddbf 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -45,6 +45,20 @@ def _load_data(self, env, data_source, encoding): sys.path.append(os.getcwd()) # noqa + +# Updates for RTD changes +# 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", "https://www.writethedocs.org") + +# 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 + + from _ext.core import ( render_rst_with_jinja, override_template_load_context, set_html_context, unset_html_context )