Move deprecated page, add redirects

This commit is contained in:
Lachlan Campbell 2020-11-09 19:58:16 +00:00
parent 9b0750dae8
commit efc479e50a
2 changed files with 113 additions and 5 deletions

View file

@ -11,14 +11,34 @@ module.exports = withMDX({
},
async redirects() {
return [
{ source: '/start/', destination: '/', permanent: false },
{ source: '/clubs/', destination: '/', permanent: false },
{ source: '/c9/', destination: '/cloud9/', permanent: true },
{ source: '/cloud9_setup/', destination: '/cloud9/', permanent: true },
{ source: '/repl/', destination: '/', permanent: true },
{ source: '/c9/', destination: '/deprecated/cloud9/', permanent: true },
{
source: '/cloud9_setup/',
destination: '/deprecated/cloud9/',
permanent: true
},
{
source: '/redeem_tech_domain/',
destination: '/deprecated/tech_domains/',
permanent: true
},
{
source: '/challenge/',
destination: '/deprecated/challenge/',
permanent: true
},
{
source: '/santa/',
destination: '/deprecated/santa/',
permanent: false
},
{ source: '/slack_invite/', destination: '/slack/', permanent: true },
{ source: '/workshops/slack/', destination: '/slack/', permanent: true },
{ source: '/community/', destination: '/slack/', permanent: true },
{ source: '/hack_camp/', destination: '/camp/', permanent: true },
{ source: '/repl/', destination: '/', permanent: true },
{ source: '/branding/', destination: '/brand/', permanent: true },
{ source: '/ama/', destination: '/amas/', permanent: false },
{ source: '/coc/', destination: '/conduct/', permanent: true },
@ -127,8 +147,12 @@ module.exports = withMDX({
destination: 'https://map.hackclub.dev/'
},
{
source: '/:slug*',
destination: 'https://site.hackclub.dev/:slug*'
source: '/:path*',
destination: '/:path*'
},
{
source: '/:path*',
destination: 'https://v2.hackclub.dev/:path*'
}
]
},

View file

@ -0,0 +1,84 @@
import { Box, Button, Container, Heading, Text } from 'theme-ui'
import theme from '@hackclub/theme'
import Meta from '@hackclub/meta'
import Icon from '@hackclub/icons'
import Head from 'next/head'
import Nav from '../../components/nav'
import Footer from '../../components/footer'
const DeprecatedPage = ({ page: { name, desc, icon, link } = {} }) => (
<>
<Nav dark />
<Meta
as={Head}
title={name}
desc={`Hack Club no longer offers ${name}. Learn more here.`}
image={`https://workshop-cards.hackclub.com/${encodeURIComponent(
name
)}.png?theme=dark&caption=deprecated&fontSize=250px&brand=HQ`}
/>
<Box
as="main"
sx={{
bg: 'dark',
color: 'muted',
pt: [5, 6],
pb: [4, 5],
textAlign: 'center'
}}
>
<Container variant="copy" as="article">
<Icon size={128} glyph={icon} />
<Heading as="h1" variant="headline" sx={{ color: 'snow', my: [2, 3] }}>
We no longer offer {name}.
</Heading>
<Heading as="h2" variant="subtitle" sx={{ mb: 4 }}>
{desc}
</Heading>
<Button as="a" href={link}>
Check it out »
</Button>
</Container>
</Box>
<Footer dark />
</>
)
export default DeprecatedPage
const pages = {
cloud9: {
name: 'Cloud9',
desc: 'Cloud9 has been replaced by repl.it, a newer online IDE.',
link: 'https://repl.it/?ref=hackclub',
icon: 'terminal'
},
challenge: {
name: 'Challenge',
desc: 'If you miss Hack Club Challenge, check out Scrapbook!',
link: 'https://scrapbook.hackclub.com/',
icon: 'sticker'
},
tech_domains: {
name: '.TECH domains',
desc: 'If youre looking for a domain, you can get one via the Hack Pack.',
link: 'https://hack.af/pack',
icon: 'web'
},
santa: {
name: 'Secret Santa 2019',
desc: 'Community members are planning our 2020 Secret Santa in our Slack.',
link: 'https://hackclub.com/slack/',
icon: 'freeze'
}
}
export const getStaticPaths = () => {
const paths = Object.keys(pages).map(key => ({ params: { deprecated: key } }))
return { paths, fallback: false }
}
export const getStaticProps = ({ params }) => {
const page = pages[params.deprecated]
return { props: { page } }
}