We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2ce517f commit 9c357bcCopy full SHA for 9c357bc
1 file changed
demo/navigation-types/scripts.js
@@ -5,7 +5,12 @@
5
6
import { useAutoTypes } from "../js/navigation.js";
7
8
-const basePath = window.location.pathname.startsWith("/demo") ? "/demo" : "";
+// Because this demo can be hosted anywhere (in a root, or a subfolder) we need to determine the basePath
9
+// that acts as as a prefix to the routes.
10
+const basePath = window.location.pathname.substring(
11
+ 0,
12
+ window.location.pathname.indexOf("/navigation-types"),
13
+);
14
const routeMap = {
15
index: `${basePath}/navigation-types/demo{.html}?`,
16
detail: `${basePath}/navigation-types/detail/:id{.html}?`,
0 commit comments