From 26cb90327640d08e88f24705794c6eb2cac2e700 Mon Sep 17 00:00:00 2001 From: hfadzxy Date: Mon, 12 May 2025 19:34:50 +0800 Subject: [PATCH] [Misc][Doc] Add the latest stable release url Signed-off-by: hfadzxy --- docs/source/_templates/sections/header.html | 58 +++++++++++++++++++++ docs/source/conf.py | 13 ++++- 2 files changed, 70 insertions(+), 1 deletion(-) 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 0000000000..fc655eeb5f --- /dev/null +++ b/docs/source/_templates/sections/header.html @@ -0,0 +1,58 @@ + + + +
+

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

+
\ No newline at end of file diff --git a/docs/source/conf.py b/docs/source/conf.py index 09abc2d612..3c626c3bcb 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -23,7 +23,8 @@ # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # -# import os +import os + # import sys # sys.path.insert(0, os.path.abspath('.')) @@ -119,6 +120,16 @@ # so a file named "default.css" will overwrite the builtin "default.css". # html_static_path = ['_static'] +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") + # The file might be removed already if the build is triggered multiple times + # (readthedocs build both HTML and PDF versions separately) + if os.path.exists(header_file): + os.remove(header_file) + def setup(app): pass