diff --git a/Doc/conf.py b/Doc/conf.py index b218e3e7c0464e..34715918a5fe5b 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -561,6 +561,17 @@ refcount_file = 'data/refcounts.dat' stable_abi_file = 'data/stable_abi.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 # -------------------------------