Skip to content

Commit 2719ca9

Browse files
committed
fix: version switcher to follow root URLs
1 parent 092d937 commit 2719ca9

2 files changed

Lines changed: 4 additions & 16 deletions

File tree

docs/_static/switcher.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
[
22
{
3-
"name": "1.3 (stable)",
3+
"name": "1.3",
44
"version": "1.3",
55
"url": "https://docs.openspp.org/"
66
},
77
{
8-
"name": "2.0 (preview)",
8+
"name": "2.0",
99
"version": "2.0",
1010
"url": "https://docs.openspp.org/v2.0/"
1111
}

docs/_static/version_switcher.js

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,8 @@ document.addEventListener('DOMContentLoaded', function() {
2424

2525
// Handle version change
2626
document.getElementById('version-select').addEventListener('change', function(e) {
27-
const newUrl = e.target.value;
28-
// Get current page path, removing any version prefix
29-
let currentPath = window.location.pathname;
30-
31-
// Remove version prefixes: /previews/branch-name/ or /v1.3/ or /1.3/
32-
// This regex matches /previews/anything/ at the start
33-
currentPath = currentPath.replace(/^\/previews\/[^\/]+\//, '/');
34-
// This regex matches /v1.3/ or /1.3/ patterns at the start (with optional 'v' prefix)
35-
currentPath = currentPath.replace(/^\/v?[0-9.]+\//, '/');
36-
// Remove leading slash since newUrl already has trailing slash
37-
currentPath = currentPath.replace(/^\/+/, '');
38-
39-
// Navigate to same page in new version
40-
window.location.href = newUrl + currentPath;
27+
// Navigate to the landing page of the selected version
28+
window.location.href = e.target.value;
4129
});
4230
}
4331
})

0 commit comments

Comments
 (0)