Skip to content

Commit c33198e

Browse files
committed
doc: add RTD version-switch div on furo theme
Signed-off-by: Xavier Delaruelle <[email protected]>
1 parent a4a5e37 commit c33198e

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<a class="sidebar-brand{% if logo %} centered{% endif %}" href="{{ pathto(master_doc) }}">
2+
{%- block brand_content %}
3+
{#- Remember to update the prefetch logic in `block logo_prefetch_links` in base.html #}
4+
{%- if logo_url %}
5+
<div class="sidebar-logo-container">
6+
<img class="sidebar-logo" src="{{ logo_url }}" alt="Logo"/>
7+
</div>
8+
{%- endif %}
9+
{%- if theme_light_logo and theme_dark_logo %}
10+
<div class="sidebar-logo-container">
11+
<img class="sidebar-logo only-light" src="{{ pathto('_static/' + theme_light_logo, 1) }}" alt="Light Logo"/>
12+
<img class="sidebar-logo only-dark" src="{{ pathto('_static/' + theme_dark_logo, 1) }}" alt="Dark Logo"/>
13+
</div>
14+
{%- endif %}
15+
{% if not theme_sidebar_hide_name %}
16+
<span class="sidebar-brand-text">{{ docstitle if docstitle else project }}</span>
17+
{%- endif %}
18+
{% endblock brand_content %}
19+
</a>
20+
{%- if READTHEDOCS %}
21+
<div class="version-switch"></div>
22+
{%- endif %}

doc/source/conf.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ def get_version_release_from_git():
140140
'light_logo': 'modules_red.svg',
141141
'dark_logo': 'modules_white.svg',
142142
}
143+
html_context = {
144+
'READTHEDOCS': True,
145+
}
143146

144147
# The name of an image file (relative to this directory) to place at the top
145148
# of the sidebar.

0 commit comments

Comments
 (0)