diff --git a/docs/src/_templates/layout.html b/docs/src/_templates/layout.html deleted file mode 100644 index 974bd12753..0000000000 --- a/docs/src/_templates/layout.html +++ /dev/null @@ -1,20 +0,0 @@ -{% extends "pydata_sphinx_theme/layout.html" %} - -{# This uses blocks. See: - https://www.sphinx-doc.org/en/master/templating.html -#} - - - {%- block docs_body %} - - {% if on_rtd and rtd_version == 'latest' %} -
- You are viewing the latest unreleased documentation - v{{ version }}. You can switch to a stable version - via the flyout menu in the bottom corner of the screen. -
-

- {%- endif %} - - {{ super() }} -{%- endblock %} diff --git a/docs/src/conf.py b/docs/src/conf.py index 7f7322c1f8..5b3fd9433b 100644 --- a/docs/src/conf.py +++ b/docs/src/conf.py @@ -329,6 +329,16 @@ def _dotv(version): }, } +# if we are building via Read The Docs and it is the latest (not stable) +if on_rtd and rtd_version == "latest": + html_theme_options[ + "announcement" + ] = f""" + You are viewing the latest unreleased documentation + {version}. You can switch to a + stable + version.""" + rev_parse = run(["git", "rev-parse", "--short", "HEAD"], capture_output=True) commit_sha = rev_parse.stdout.decode().strip()