Skip to content

Commit 5def175

Browse files
committed
Add support for latest redirect
1 parent 9c00b22 commit 5def175

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

docs/css/dropdown.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ overflow: inherit;
1818
/* The container <div> - needed to position the dropdown content */
1919
.dropdown {
2020
position: absolute;
21-
display: flex;
21+
display: inline-block;
2222
}
2323

2424
/* Dropdown Content (Hidden by Default) */

docs/js/inject-api-links.js

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
window.addEventListener("DOMContentLoaded", function () {
22
var windowPathNameSplits = window.location.pathname.split("/");
33
var majorVersionRegex = new RegExp("(\\d+[.]\\d+)")
4+
var latestRegex = new RegExp("latest")
45
if (majorVersionRegex.test(windowPathNameSplits[1])) { // On landing page docs.hopsworks.api/3.0 - URL contains major version
56
// Version API dropdown
67
document.getElementById("hopsworks_api_link").href = "https://docs.hopsworks.ai/hopsworks-api/" + windowPathNameSplits[1] + "/generated/api/login/";
78
document.getElementById("hsfs_api_link").href = "https://docs.hopsworks.ai/feature-store-api/" + windowPathNameSplits[1] + "/generated/api/connection_api/";
9+
document.getElementById("hsfs_javadoc_link").href = "https://docs.hopsworks.ai/feature-store-api/" + windowPathNameSplits[1] + "/javadoc";
810
document.getElementById("hsml_api_link").href = "https://docs.hopsworks.ai/machine-learning-api/" + windowPathNameSplits[1] + "/generated/connection_api/";
911
} else { // on docs.hopsworks.api/feature-store-api/3.0 / docs.hopsworks.api/hopsworks-api/3.0 / docs.hopsworks.api/machine-learning-api/3.0
10-
var apiVersion = windowPathNameSplits[2];
11-
var majorVersion = apiVersion.match(majorVersionRegex)[0];
12+
13+
if (latestRegex.test(windowPathNameSplits[2]) || latestRegex.test(windowPathNameSplits[1])) {
14+
var majorVersion = "latest";
15+
} else {
16+
var apiVersion = windowPathNameSplits[2];
17+
var majorVersion = apiVersion.match(majorVersionRegex)[0];
18+
}
1219
// Version main navigation
1320
document.getElementsByClassName("md-tabs__link")[0].href = "https://docs.hopsworks.ai/" + majorVersion;
1421
document.getElementsByClassName("md-tabs__link")[1].href = "https://colab.research.google.com/github/logicalclocks/hopsworks-tutorials/blob/master/quickstart.ipynb";

0 commit comments

Comments
 (0)