Skip to content

Commit

Permalink
sidebar template
Browse files Browse the repository at this point in the history
  • Loading branch information
liuanji committed Feb 14, 2024
1 parent c0c19b4 commit 1294634
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
7 changes: 4 additions & 3 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 27 additions & 0 deletions docs/source/templates/versions.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{%- if current_version %}
<div class="rst-versions" data-toggle="rst-versions" role="note" aria-label="versions">
<span class="rst-current-version" data-toggle="rst-current-version">
<span class="fa fa-book"> Other Versions</span>
v: {{ current_version.name }}
<span class="fa fa-caret-down"></span>
</span>
<div class="rst-other-versions">
{%- if versions.tags %}
<dl>
<dt>Tags</dt>
{%- for item in versions.tags %}
<dd><a href="{{ item.url }}">{{ item.name }}</a></dd>
{%- endfor %}
</dl>
{%- endif %}
{%- if versions.branches %}
<dl>
<dt>Branches</dt>
{%- for item in versions.branches %}
<dd><a href="{{ item.url }}">{{ item.name }}</a></dd>
{%- endfor %}
</dl>
{%- endif %}
</div>
</div>
{%- endif %}

0 comments on commit 1294634

Please sign in to comment.