Skip to content

Commit a31d2f9

Browse files
Redirect to old wiki: remove trailing slash if any
1 parent c9f6be6 commit a31d2f9

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

web/src/components/ItemDescription.astro

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ interface Props {
77
88
const { description } = Astro.props;
99
10-
const path = Astro.url.pathname;
10+
let path = Astro.url.pathname;
11+
// Remove trailing slash if any
12+
path = path.endsWith('/') ? path.slice(0, -1) : path;
1113
---
1214
{description.includes("NEEDS DOCUMENTATION") ? (
1315
<p style="color: var(--sl-color-orange); font-size: 2rem;"><strong>This page is incomplete! Help wanted!</strong>

web/src/pages/404.astro

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ import { OLD_WIKI_URL, OLD_WIKI_REDIRECT } from '@src/content.constants';
2727
if (el) el.textContent = countdown;
2828
if (countdown <= 0) {
2929
clearInterval(interval);
30-
window.location.replace(OLD_WIKI_URL + location.pathname);
30+
let path = location.pathname;
31+
// Remove trailing slash if any
32+
path = path.endsWith('/') ? path.slice(0, -1) : path;
33+
window.location.replace(OLD_WIKI_URL + path);
3134
}
3235
}, 1000);
3336
</script>

0 commit comments

Comments
 (0)