From 12946346ea9f59a05545ecc936b4c6d8d2c95804 Mon Sep 17 00:00:00 2001 From: Anji Liu Date: Wed, 14 Feb 2024 12:08:30 +0800 Subject: [PATCH] sidebar template --- docs/source/conf.py | 7 ++++--- docs/source/templates/versions.html | 27 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 docs/source/templates/versions.html diff --git a/docs/source/conf.py b/docs/source/conf.py index c0950ff5..f1fe11d7 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -34,11 +34,12 @@ # -- Options for EPUB output epub_show_urls = 'footnote' +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] html_sidebars = { '**': [ - # 'relations.html', # needs 'show_related': True theme option to display - 'searchbox.html', - ] + '_templates/versions.html', + ], } # autosummary_generate = True diff --git a/docs/source/templates/versions.html b/docs/source/templates/versions.html new file mode 100644 index 00000000..c49f844c --- /dev/null +++ b/docs/source/templates/versions.html @@ -0,0 +1,27 @@ +{%- if current_version %} +
+ + Other Versions + v: {{ current_version.name }} + + +
+ {%- if versions.tags %} +
+
Tags
+ {%- for item in versions.tags %} +
{{ item.name }}
+ {%- endfor %} +
+ {%- endif %} + {%- if versions.branches %} +
+
Branches
+ {%- for item in versions.branches %} +
{{ item.name }}
+ {%- endfor %} +
+ {%- endif %} +
+
+{%- endif %} \ No newline at end of file