From f1e88d775d21a7e73fe614e49f94624af8054060 Mon Sep 17 00:00:00 2001 From: Sarah Gibson Date: Tue, 27 Aug 2024 11:55:50 +0100 Subject: [PATCH] Set canonical custom domain URL for ReadTheDocs AddOns migration --- conf.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/conf.py b/conf.py index 7a48ef67..84a90146 100644 --- a/conf.py +++ b/conf.py @@ -1,3 +1,4 @@ +import os from pathlib import Path from subprocess import run @@ -146,3 +147,15 @@ def setup(app): nb_execution_timeout = -1 # no timeout nb_execution_mode = 'auto' suppress_warnings = ["mystnb.unknown_mime_type"] + +# -- Set canonical custom domain via html_baseurl ----------- +# -- See https://github.com/2i2c-org/infrastructure/issues/4629 + +html_context = {} + +# Set canonical URL from the Read the Docs Domain +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 \ No newline at end of file