Skip to content

Commit bd7ba5f

Browse files
Kosthiclaude
andcommitted
fix: instant redirect from root to /zh/
Replace Astro.redirect() with meta refresh + JS redirect for immediate navigation without waiting for JS load. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent affb833 commit bd7ba5f

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

src/pages/index.astro

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
---
22
import { defaultLang } from '../i18n';
3-
4-
// Redirect root to default language
5-
return Astro.redirect(`/${defaultLang}/`);
3+
const redirectUrl = `/${defaultLang}/`;
64
---
5+
<!DOCTYPE html>
6+
<html lang={defaultLang}>
7+
<head>
8+
<meta charset="UTF-8">
9+
<meta http-equiv="refresh" content="0;url={redirectUrl}">
10+
<link rel="canonical" href={redirectUrl}>
11+
<title>Redirecting...</title>
12+
</head>
13+
<body>
14+
<script define:vars={{ redirectUrl }}>
15+
window.location.replace(redirectUrl);
16+
</script>
17+
<noscript>
18+
<meta http-equiv="refresh" content="0;url={redirectUrl}">
19+
<a href={redirectUrl}>Click here to continue</a>
20+
</noscript>
21+
</body>
22+
</html>

0 commit comments

Comments
 (0)