From 2a39bbb96d1981d1af375d2d47ab0b6a394e7a38 Mon Sep 17 00:00:00 2001 From: Tony Meyer Date: Tue, 8 Oct 2024 13:14:13 +1300 Subject: [PATCH] docs: set the READTHEDOCS context variable (#1410) As of October 7th, the `html_context` dictionary is meant to contain a `READTHEDOCS` key set to True if that's in the environment variables, so this change does that. We may see small changes in the visual look of the docs but everything should keep working with this small adjustment. [Instructions from Read the Docs](https://about.readthedocs.com/blog/2024/07/addons-by-default/) Fixes #1393 --- docs/custom_conf.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/custom_conf.py b/docs/custom_conf.py index bf2485ab2..e127915f6 100644 --- a/docs/custom_conf.py +++ b/docs/custom_conf.py @@ -13,6 +13,7 @@ # limitations under the License. import datetime +import os import pathlib import sys @@ -137,6 +138,9 @@ # Valid options: none, prev, next, both 'sequential_nav': 'none', } +# Addons-by-default, see: https://about.readthedocs.com/blog/2024/07/addons-by-default/ +if os.environ.get('READTHEDOCS', '') == 'True': + html_context['READTHEDOCS'] = True # If your project is on documentation.ubuntu.com, specify the project # slug (for example, "lxd") here.