diff --git a/Doc/conf.py b/Doc/conf.py index 07e0d113a24c10..f021c9eabe4dda 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -572,6 +572,17 @@ stable_abi_file = 'data/stable_abi.dat' threadsafety_file = 'data/threadsafety.dat' +# Options for notfound.extension +# ------------------------------- + +if not os.getenv("READTHEDOCS"): + if language_code: + notfound_urls_prefix = ( + f'/{language_code.replace("_", "-").lower()}/{version}/' + ) + else: + notfound_urls_prefix = f'/{version}/' + # Options for sphinxext-opengraph # -------------------------------