Skip to content

Commit efe9613

Browse files
authored
Add matching for URLs without index.html in explorer (#186)
1 parent 724b238 commit efe9613

File tree

1 file changed

+9
-6
lines changed
  • core/webdoc-default-template/src/app/components/Explorer

1 file changed

+9
-6
lines changed

core/webdoc-default-template/src/app/components/Explorer/helpers.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
export function isSamePage(data) {
2-
const path = window.location.pathname.includes(".html") ?
3-
window.location.pathname :
4-
`${window.location.pathname}.html`;
1+
const paths = window.location.pathname.includes(".html") ?
2+
[window.location.pathname] :
3+
[
4+
`${window.location.pathname}.html`,
5+
`${window.location.pathname}/index.html`.replace("//", "/"),
6+
];
57

6-
if (data.page.startsWith("/") && data.page === path) {
8+
export function isSamePage(data) {
9+
if (data.page.startsWith("/") && paths.includes(data.page)) {
710
return true;
8-
} else if (!data.page.startsWith("/") && path.includes(`/${data.page}`)) {
11+
} else if (!data.page.startsWith("/") && paths.some((path) => path.includes(`/${data.page}`))) {
912
return true;
1013
}
1114

0 commit comments

Comments
 (0)