From fc7693727ce5e3aadabc793e2f43da3499cfb4d1 Mon Sep 17 00:00:00 2001 From: Andy Grove Date: Sat, 20 Jun 2026 18:22:52 -0600 Subject: [PATCH] docs: render captioned sidebar sections for versioned user guides --- docs/source/_templates/docs-sidebar.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/source/_templates/docs-sidebar.html b/docs/source/_templates/docs-sidebar.html index a20c715d20..11ab242542 100644 --- a/docs/source/_templates/docs-sidebar.html +++ b/docs/source/_templates/docs-sidebar.html @@ -18,10 +18,11 @@ --> {# Start the sidebar from the deepest captioned section the page lives under: - - user-guide/latest/* lives under user-guide/index.md → user-guide/latest/index.rst, so start at depth 2 + - user-guide//* (latest or a released version like 0.17) lives under + user-guide/index.md → user-guide//index.rst, so start at depth 2 - contributor-guide/* lives under contributor-guide/index.md, so start at depth 1 - root and orphan pages (search, genindex) fall back to the global toctree (depth 0). #} -{% if pagename.startswith("user-guide/latest/") and not suppress_sidebar_toctree(startdepth=2, includehidden=True) %} +{% if pagename.startswith("user-guide/") and pagename.split("/")|length > 2 and not suppress_sidebar_toctree(startdepth=2, includehidden=True) %} {% set sidebar_startdepth = 2 %} {% elif not suppress_sidebar_toctree(startdepth=1, includehidden=True) %} {% set sidebar_startdepth = 1 %}