Skip to content

Commit 4d941c9

Browse files
committed
Fix URL
1 parent 4ab650d commit 4d941c9

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

spec/_static/javascripts/version_dropdown.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,18 @@ function add_version_dropdown(json_loc, target_loc, text) {
1010
dropdown.appendChild(content);
1111
console.log('*********');
1212
$.getJSON(json_loc, function(versions) {
13+
var currentURL = window.location.href;
14+
var path = currentURL.split( "_site" )[ 1 ];
15+
path = path.split('/');
16+
path = path.slice(1, path.length);
17+
path = path.join('/');
1318
for (var key in versions) {
1419
if (versions.hasOwnProperty(key)) {
1520
console.log(key, versions[key]);
16-
var currentURL = window.location.href;
17-
var path = currentURL.split( versions[key] )[ 1 ];
1821
var a = document.createElement("a");
1922
a.innerHTML = key;
2023
a.title = key;
21-
a.href = target_loc + versions[key] + path;
24+
a.href = target_loc + versions[key] + "/" + path;
2225
console.log('----', a.href);
2326
content.appendChild(a);
2427
}

0 commit comments

Comments
 (0)