Skip to content

Commit f9c6d3f

Browse files
authored
Add redirect handler (#5)
* Add redirect handler * Add redirect handler
1 parent 8f48173 commit f9c6d3f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/pages/index.jsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@ import Layout from '@theme/Layout';
44
import Head from '@docusaurus/Head';
55
import HeroCanvas from '@site/src/components/HeroCanvas';
66

7+
const REDIRECTS = {
8+
'tutorials': 'https://youtube.com/@8thwall',
9+
}
10+
11+
const REDIRECT_SCRIPT = `
12+
const sitePath = new URLSearchParams(window.location.search).get('site_path');
13+
const redirects = ${JSON.stringify(REDIRECTS)};
14+
if (sitePath && redirects[sitePath]) {
15+
window.location.replace(redirects[sitePath]);
16+
}
17+
`
18+
19+
720
export default function Home() {
821
return (
922
<Layout title="Open Source AR & 3D" description="Build immersive AR and interactive 3D experiences. Free and open source.">
@@ -12,6 +25,7 @@ export default function Home() {
1225
<meta property="og:title" content="8th Wall - Open Source AR & 3D" />
1326
<meta name="twitter:title" content="8th Wall - Open Source AR & 3D" />
1427
<meta name="twitter:description" content="Build immersive AR and interactive 3D experiences. Free and open source." />
28+
<script type="module">{REDIRECT_SCRIPT}</script>
1529
</Head>
1630
<section className="hero" id="hero">
1731
<HeroCanvas />

0 commit comments

Comments
 (0)