Skip to content

Commit

Permalink
chore(docs): adding redirects for play and learn (#996)
Browse files Browse the repository at this point in the history
Co-authored-by: David Boyne <[email protected]>
  • Loading branch information
boyney123 and David Boyne authored Sep 4, 2024
1 parent 3343a7e commit f9b3085
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
8 changes: 8 additions & 0 deletions redirects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,13 @@ export default [
{ to: '/docs/api/category/ui', from: ['/docs/category/ui'] },
{ to: '/docs/api/category/util', from: ['/docs/category/util'] },
{ to: '/docs/api/standard-library', from: ['/docs/category/standard-library'] },

// redirects for wing.learn section
{ to: "https://learn.winglang.io/learn", from: ["/learn/"] },
{ to: "https://learn.winglang.io/learn/preflight-inflight", from: ["/learn/preflight-inflight"] },
{ to: "https://learn.winglang.io/learn/bucket", from: ["/learn/bucket"] },
{ to: "https://learn.winglang.io/learn/counter", from: ["/learn/counter"] },
{ to: "https://learn.winglang.io/learn/queue", from: ["/learn/queue"] },
{ to: "https://learn.winglang.io/learn/topic", from: ["/learn/topic"] },

]
18 changes: 18 additions & 0 deletions src/pages/play.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { useEffect } from 'react';

// Load the docs by default
export default function Home() {
useEffect(() => {
// Get the query string code
const urlParams = new URLSearchParams(window.location.search);
const code = urlParams.get('code');
if (code) {
// Redirect to the play page with the code
// @ts-ignore
window.location = `https://play.winglang.io/play?code=${code}`;
return;
}
// @ts-ignore
window.location = 'https://play.winglang.io/play';
}, [])
}

0 comments on commit f9b3085

Please sign in to comment.