Skip to content

Commit dfeaf19

Browse files
committed
Fix images location and add versions.js
1 parent e8c575c commit dfeaf19

2 files changed

Lines changed: 39 additions & 2 deletions

File tree

_static/js/versions.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// taken from https://github.com/readthedocs/sphinx_rtd_theme/blob/3.0.2/sphinx_rtd_theme/static/js/versions.js_t
2+
3+
function onSelectorSwitch(event) {
4+
const option = event.target.selectedIndex;
5+
const item = event.target.options[option];
6+
window.location.href = item.dataset.url;
7+
}
8+
9+
document.addEventListener("readthedocs-addons-data-ready", function (event) {
10+
const config = event.detail.data();
11+
12+
const versionSwitch = document.querySelector(
13+
"div.version-switch",
14+
);
15+
let versions = config.versions.active;
16+
if (config.versions.current.hidden || config.versions.current.type === "external") {
17+
versions.unshift(config.versions.current);
18+
}
19+
const versionSelect = `
20+
<select>
21+
${versions
22+
.map(
23+
(version) => `
24+
<option
25+
value="${version.slug}"
26+
${config.versions.current.slug === version.slug ? 'selected="selected"' : ""}
27+
data-url="${version.urls.documentation}">
28+
${version.slug}
29+
</option>`,
30+
)
31+
.join("\n")}
32+
</select>
33+
`;
34+
35+
versionSwitch.innerHTML = versionSelect;
36+
versionSwitch.firstElementChild.addEventListener("change", onSelectorSwitch);
37+
})

conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ def setup(sphinx):
158158
# of the sidebar.
159159
html_theme_options = {
160160
"sidebar_hide_name": True,
161-
"light_logo": "spack-logo-text.svg",
162-
"dark_logo": "spack-logo-white-text.svg",
161+
"light_logo": "images/spack-logo-text.svg",
162+
"dark_logo": "images/spack-logo-white-text.svg",
163163
}
164164

165165
# The name of an image file (within the static path) to use as favicon of the

0 commit comments

Comments
 (0)