Skip to content

Commit 2836da5

Browse files
authored
Add redirect handlers for forum and contact (#38)
* Add redirect handlers for forum and contact * Add redirect handlers for forum and contact
1 parent c9d864a commit 2836da5

2 files changed

Lines changed: 19 additions & 14 deletions

File tree

src/pages/_redirects.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const REDIRECTS = {
2+
'tutorials': 'https://youtube.com/@8thwall',
3+
'twainxreducation/brandigno': 'https://twainxreducation.8thwall.app/brandigno/',
4+
'contact': '#get-involved',
5+
'forum': '#get-involved',
6+
}
7+
8+
const REDIRECT_SCRIPT = `
9+
const sitePath = new URLSearchParams(window.location.search).get('site_path');
10+
const redirects = ${JSON.stringify(REDIRECTS)};
11+
if (sitePath && redirects[sitePath]) {
12+
window.location.replace(redirects[sitePath]);
13+
}
14+
`
15+
16+
export {
17+
REDIRECT_SCRIPT
18+
}

src/pages/index.jsx

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,7 @@ import Link from '@docusaurus/Link';
33
import Layout from '@theme/Layout';
44
import Head from '@docusaurus/Head';
55
import HeroCanvas from '@site/src/components/HeroCanvas';
6-
7-
const REDIRECTS = {
8-
'tutorials': 'https://youtube.com/@8thwall',
9-
'twainxreducation/brandigno': 'https://twainxreducation.8thwall.app/brandigno/',
10-
}
11-
12-
const REDIRECT_SCRIPT = `
13-
const sitePath = new URLSearchParams(window.location.search).get('site_path');
14-
const redirects = ${JSON.stringify(REDIRECTS)};
15-
if (sitePath && redirects[sitePath]) {
16-
window.location.replace(redirects[sitePath]);
17-
}
18-
`
19-
6+
import {REDIRECT_SCRIPT} from './_redirects'
207

218
export default function Home() {
229
return (

0 commit comments

Comments
 (0)