Skip to content

Commit 76630e6

Browse files
committed
proof of concept
1 parent 1f7ee64 commit 76630e6

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@
175175
# "footer_start": ["test.html", "test.html"],
176176
# "secondary_sidebar_items": ["page-toc.html"], # Remove the source buttons
177177
"switcher": {
178+
"use_rtd": True,
178179
"json_url": json_url,
179180
"version_match": version_match,
180181
},
Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
{# As the version switcher will only work when JavaScript is enabled, we add it through JavaScript.
22
#}
3-
<script>
4-
document.write(`
5-
<div class="version-switcher__container dropdown">
6-
<button id="versionswitcherbutton" type="button" role="button" class="version-switcher__button btn btn-sm navbar-btn dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="listbox" aria-controls="versionswitcherlist" aria-label="Version switcher list">
7-
{{ theme_switcher.get('version_match') }} <!-- this text may get changed later by javascript -->
8-
<span class="caret"></span>
9-
</button>
10-
<div id="versionswitcherlist" class="version-switcher__menu dropdown-menu list-group-flush py-0" role="listbox" aria-labelledby="versionswitcherbutton">
11-
<!-- dropdown will be populated by javascript on page load -->
12-
</div>
13-
</div>
14-
`);
15-
</script>
3+
{% if theme_switcher.get('use_rtd') is defined and theme_switcher.get('use_rtd') %}
4+
<script>
5+
document.write(`<div id="readthedocs-embed-flyout"></div>`);
6+
</script>
7+
{% else %}
8+
<script>
9+
document.write(`
10+
<div class="version-switcher__container dropdown">
11+
<button id="versionswitcherbutton" type="button" role="button" class="version-switcher__button btn btn-sm navbar-btn dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="listbox" aria-controls="versionswitcherlist" aria-label="Version switcher list">
12+
{{ theme_switcher.get('version_match') }} <!-- this text may get changed later by javascript -->
13+
<span class="caret"></span>
14+
</button>
15+
<div id="versionswitcherlist" class="version-switcher__menu dropdown-menu list-group-flush py-0" role="listbox" aria-labelledby="versionswitcherbutton">
16+
<!-- dropdown will be populated by javascript on page load -->
17+
</div>
18+
</div>
19+
`);
20+
</script>
21+
{% endif %}

0 commit comments

Comments
 (0)