Skip to content

Commit 10220ca

Browse files
authored
Merge pull request #93072 from gabriel-rh/page-loader-subfolder-in-version
fix current version to allow for subdirectory in github actions
2 parents d46894d + cb8328b commit 10220ca

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

_javascripts/page-loader.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,17 @@ function versionSelector(list) {
4141
if (dk === "openshift-origin") {
4242
currentVersion = window.location.pathname.split("/")[1];
4343
} else {
44-
currentVersion = window.location.pathname.split("/")[2];
44+
const path = window.location.pathname;
45+
const pathParts = path.split('/').filter(part => part.length > 0);
46+
47+
// Check if we're in the openshift-docs subdirectory for github pages
48+
if (pathParts.length > 0 && pathParts[0] === 'openshift-docs') {
49+
currentVersion = pathParts[2];
50+
} else {
51+
// If not in the openshift-docs subdirectory
52+
currentVersion = pathParts[1];
53+
}
54+
4555
}
4656

4757
// Get the correct URL path from the urlMappings and prepend the base URL

0 commit comments

Comments
 (0)