From 27902d42beeeb5828ef3243d5455a3b9af3317b3 Mon Sep 17 00:00:00 2001 From: youkaichao Date: Thu, 4 Jul 2024 09:57:09 -0700 Subject: [PATCH] [misc][doc] try to add warning for latest html (#5979) --- docs/source/_templates/sections/header.html | 38 +++++++++++++++++++++ docs/source/conf.py | 8 +++++ 2 files changed, 46 insertions(+) create mode 100644 docs/source/_templates/sections/header.html diff --git a/docs/source/_templates/sections/header.html b/docs/source/_templates/sections/header.html new file mode 100644 index 00000000..cd5c4053 --- /dev/null +++ b/docs/source/_templates/sections/header.html @@ -0,0 +1,38 @@ + + +
+

You are viewing the latest developer preview docs. Click here to view docs for the latest stable release.

+
diff --git a/docs/source/conf.py b/docs/source/conf.py index 7c5bb8f7..46a3bcbf 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -69,6 +69,14 @@ html_theme_options = { 'use_edit_page_button': True, } +# see https://docs.readthedocs.io/en/stable/reference/environment-variables.html # noqa +READTHEDOCS_VERSION_TYPE = os.environ.get('READTHEDOCS_VERSION_TYPE') +if READTHEDOCS_VERSION_TYPE == "tag": + # remove the warning banner if the version is a tagged release + header_file = os.path.join(os.path.dirname(__file__), + "_templates/sections/header.html") + os.remove(header_file) + # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css".