Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/pages/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,24 @@ const REDIRECTS = {
'tutorials': 'https://youtube.com/@8thwall',
}

// NOTE(christoph): If a user is linked to a featured project page such as
// https://8thwall.com/workspace/project, they will be redirected to
// 8thwall.org?site_path=workspace/project. We can then forward that to the published domain:
// https://workspace.8thwall.app/project
const PUBLISHED_DOMAIN_REDIRECTS = [
'mindoverdevelopment',
]

const REDIRECT_SCRIPT = `
const sitePath = new URLSearchParams(window.location.search).get('site_path');
const redirects = ${JSON.stringify(REDIRECTS)};
if (sitePath && redirects[sitePath]) {
window.location.replace(redirects[sitePath]);
} else {
const domainRedirect = ${JSON.stringify(PUBLISHED_DOMAIN_REDIRECTS)}.find(domain => sitePath.startsWith(domain + '/'));
if (domainRedirect) {
window.location.replace('https://' + domainRedirect + '.8thwall.app/' + sitePath.substring(domainRedirect.length + 1));
}
}
`

Expand Down
Loading