Skip to content

Commit b67f0ee

Browse files
authored
Merge pull request #93066 from gabriel-rh/page-loader-subfolder
handle subfolder for github pages
2 parents 6d5cb35 + f676773 commit b67f0ee

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

_javascripts/page-loader.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,15 @@ let fileRequested = "";
55

66
// Get the base URL dynamically
77
function getBaseUrl() {
8+
const path = window.location.pathname;
9+
const pathParts = path.split('/').filter(part => part.length > 0);
810

9-
// Fallback to current origin
11+
// Check if we're in the openshift-docs subdirectory for github pages
12+
if (pathParts.length > 0 && pathParts[0] === 'openshift-docs') {
13+
return `${window.location.protocol}//${window.location.host}/openshift-docs/`;
14+
}
15+
16+
// If not in the openshift-docs subdirectory, use the root
1017
return `${window.location.protocol}//${window.location.host}/`;
1118
}
1219

0 commit comments

Comments
 (0)