-
Notifications
You must be signed in to change notification settings - Fork 0
Feat: landing page ssr + seo optimization #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
5f249d9
017f300
5f15f8d
48e2cf2
afa88fb
cb00dd1
3d897b2
9d382f3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| 'use client'; | ||
|
|
||
| // This page is temporary to ease the migration to Next.js App Router | ||
| // It will be deprecated once the migration is fully complete | ||
| import { type ReactNode, use } from 'react'; | ||
| import dynamic from 'next/dynamic'; | ||
|
|
||
| const App = dynamic(async () => await import('../../App'), { ssr: false }); | ||
|
|
||
| interface PageProps { | ||
| params: Promise<{ | ||
| locale: string; | ||
| slug: string[]; | ||
| }>; | ||
| } | ||
|
|
||
| export default function Page({ params }: PageProps): ReactNode { | ||
| const { locale } = use(params); | ||
|
|
||
| // Pass locale to App so BrowserRouter can use correct basename | ||
| return <App locale={locale} />; | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,12 +1,14 @@ | ||||||
| import { Container, Typography, Button } from '@mui/material'; | ||||||
| import OpenInNewIcon from '@mui/icons-material/OpenInNew'; | ||||||
| import { type ReactElement } from 'react'; | ||||||
| import { getTranslations } from 'next-intl/server'; | ||||||
|
|
||||||
| export default async function AboutPage(): Promise<ReactElement> { | ||||||
| const t = await getTranslations('about'); | ||||||
|
|
||||||
| export default function Page(): ReactElement { | ||||||
| return ( | ||||||
| <Container component='main'> | ||||||
| <Typography variant='h1'>About</Typography> | ||||||
| {/* ColoredContainer: This component uses style which is a client use only. Investigate pattern for SSR optimal Theme rendering */} | ||||||
| <Typography variant='h1'>{t('title')}</Typography> | ||||||
| <Container | ||||||
| sx={{ | ||||||
| backgroundColor: 'background.paper', | ||||||
|
|
@@ -18,14 +20,7 @@ export default function Page(): ReactElement { | |||||
| maxWidth={false} | ||||||
| > | ||||||
| <Typography sx={{ fontWeight: 700 }}> | ||||||
| The Mobility Database is an open catalog including over 4000 GTFS, | ||||||
| GTFS Realtime, and GBFS feeds in over 75 countries. It integrates with | ||||||
| the Canonical GTFS Schedule and GBFS Validators to share data quality | ||||||
| reports for each feed. | ||||||
| <br /> <br /> | ||||||
| This database is hosted and maintained by MobilityData, the global | ||||||
| non-profit organization dedicated to the advancement of open | ||||||
| transportation data standards. | ||||||
| {t('description')} | ||||||
| <br /> | ||||||
| <Button | ||||||
| component={'a'} | ||||||
|
|
@@ -36,21 +31,18 @@ export default function Page(): ReactElement { | |||||
| rel='noreferrer' | ||||||
| target='_blank' | ||||||
| > | ||||||
| Learn more about MobilityData | ||||||
| {t('learnMore')} | ||||||
| </Button> | ||||||
| </Typography> | ||||||
| <Typography | ||||||
| variant='h5' | ||||||
| color='primary' | ||||||
| sx={{ fontWeight: 700, mt: 5, mb: 1 }} | ||||||
| > | ||||||
| Why Use the Mobility Database? | ||||||
| {t('whyUse')} | ||||||
| </Typography> | ||||||
| <Typography className='answer'> | ||||||
| The Mobility Database provides free access to historical and current | ||||||
| GTFS, GTFS Realtime, and GBFS feeds from around the world. These feeds | ||||||
| are checked for updates every day, ensuring that the data you’re | ||||||
| looking at is the most recent data available. | ||||||
| {t('whyUseAnswer')} | ||||||
| <br /> <br /> | ||||||
| In addition to our database, we develop and maintain other tools that | ||||||
| integrate with it such as | ||||||
|
|
@@ -62,7 +54,7 @@ export default function Page(): ReactElement { | |||||
| target='_blank' | ||||||
| endIcon={<OpenInNewIcon />} | ||||||
| > | ||||||
| the Canonical GTFS Schedule Validator | ||||||
| {t('gtfsValidator')} | ||||||
| </Button> | ||||||
| and | ||||||
| <Button | ||||||
|
|
@@ -73,32 +65,24 @@ export default function Page(): ReactElement { | |||||
| target='_blank' | ||||||
| endIcon={<OpenInNewIcon />} | ||||||
| > | ||||||
| the GBFS Validator. | ||||||
| {t('gbfsValidator')} | ||||||
| </Button> | ||||||
| Additional benefits of using the Mobility Database include | ||||||
|
||||||
| Additional benefits of using the Mobility Database include | |
| {t('additionalBenefitsIntro')} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import { type ReactElement } from 'react'; | ||
| import { setRequestLocale } from 'next-intl/server'; | ||
| import { type AVAILABLE_LOCALES, routing } from '../../../i18n/routing'; | ||
| import AboutPage from './components/AboutPage'; | ||
|
|
||
| export const dynamic = 'force-static'; | ||
|
|
||
| export function generateStaticParams(): Array<{ | ||
| locale: (typeof AVAILABLE_LOCALES)[number]; | ||
| }> { | ||
| return routing.locales.map((locale) => ({ locale })); | ||
| } | ||
|
|
||
| interface PageProps { | ||
| params: Promise<{ locale: string }>; | ||
| } | ||
|
|
||
| export default async function About({ | ||
| params, | ||
| }: PageProps): Promise<ReactElement> { | ||
| const { locale } = await params; | ||
|
|
||
| setRequestLocale(locale); | ||
|
|
||
| return <AboutPage />; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 47-48 contains hardcoded English text that should be moved to the translation file. This text is not internationalized while the rest of the page uses
t()for translations. Move this content tomessages/en.jsonandmessages/fr.jsonunder theaboutnamespace.