Skip to content

Commit 9dde80d

Browse files
committed
fix: use relative paths for GitHub Pages compatibility
Replace absolute /examples/ paths with relative paths and add an inline trailing-slash redirect so URLs resolve correctly on both npx serve and GitHub Pages (where the site lives under /webapi/).
1 parent 07e1340 commit 9dde80d

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

examples/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@
108108
</head>
109109
<body>
110110
<div id="app"></div>
111-
<script type="module" src="/examples/_build/js/release/build/webapi-examples.js"></script>
111+
<script>if (!location.pathname.endsWith('/')) location.replace(location.pathname + '/' + location.hash);</script>
112+
<script type="module" src="_build/js/release/build/webapi-examples.js"></script>
112113
</body>
113114
</html>

examples/main.mbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ fn main {
176176
let navigate = fn() {
177177
let hash = @webapi.window.location().hash()
178178
let (name, target) = parse_hash(hash)
179-
iframe.set_src("/examples/" + name + "/" + name + "." + target + ".html")
179+
iframe.set_src(name + "/" + name + "." + target + ".html")
180180

181181
// Remove active class from previous link
182182
match prev_active[0] {

0 commit comments

Comments
 (0)