Skip to content

Commit

Permalink
Merge pull request #101 from viash-io/update_version_dropdown
Browse files Browse the repository at this point in the history
fix 0.9.0 not being latest anymore, version dropdown name updating
  • Loading branch information
Grifs authored Dec 19, 2024
2 parents c604adf + 27f1c8a commit d966025
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
5 changes: 5 additions & 0 deletions _src/version_copy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
mkdir _versioned/new
rsync -av --exclude 'versions.js' --exclude 'versions.json' --exclude 'versioned' _site/ _versioned/new/

echo "next rename the 'new' folder to the version number"
echo "then run 'tar -cJf new.tar.xz new'"
16 changes: 16 additions & 0 deletions versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,22 @@ function setVersionLinks(json) {
// Alter the navbar logo link to point to the root
var navbarElements = document.getElementsByClassName("navbar-brand");
navbarElements[0].setAttribute("href", "/");

// Alter the version dropdown to show the displayed version
var url = window.location.pathname;
var urlParts = url.split("/");
var versionPath = "";
if (urlParts.length > 3 && urlParts[1] == "versioned") {
versionPath = urlParts[2];
}
for (var i = 0; i < json.versions.length; i++) {
var version = json.versions[i];
if (version.link == versionPath) {
var dropdownElement = document.getElementById("nav-menu-version");
dropdownElement.innerHTML = version.name;
break;
}
}
}

fetch('/versions.json')
Expand Down
2 changes: 1 addition & 1 deletion versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"link": ""
},
{
"name": "Viash 0.9.0 (Latest)",
"name": "Viash 0.9.0",
"link": "0_9_0"
},
{
Expand Down

0 comments on commit d966025

Please sign in to comment.