From 148292df28e778936937e2f15f4b4f18b054b77b Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sat, 20 Jul 2024 17:45:39 +0200 Subject: [PATCH] Doc: prepare for ReadTheDocs Deprecation: Removal of Sphinx context injection at build time Fixes #4202 --- docs/source/conf.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/source/conf.py b/docs/source/conf.py index a5814e7323..e2169a1ea8 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -267,3 +267,14 @@ source_file_root = os.path.join(os.path.dirname(__file__), os.pardir, os.pardir) source_file_url_template = "https://github.com/OSGeo/PROJ/blob/master/{}" + +# -- Specifics when documentation is built on ReadTheDocs infra + +# Cf 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": + html_context["READTHEDOCS"] = True