Skip to content

Connect, collaborate, and grow with a community of TypeScript developers

fix: wrong page titles (#949)

bautistaaa308b55602f93
diff --git a/apps/web/src/app/[locale]/layout.tsx b/apps/web/src/app/[locale]/layout.tsx
index c494e4a1..ab806199 100644
--- a/apps/web/src/app/[locale]/layout.tsx
+++ b/apps/web/src/app/[locale]/layout.tsx
@@ -2,20 +2,14 @@ import { Analytics } from '@vercel/analytics/react';
import '../../styles/globals.css';
-import { Inter } from 'next/font/google';
-import type { Metadata } from 'next';
import { Toaster } from '@repo/ui/components/toaster';
-import { Providers } from './providers';
-import { buildMetaForDefault } from '../metadata';
+import { Inter } from 'next/font/google';
import { Navigation } from '~/components/navigation';
import { getStaticParams } from '~/locales/server';
+import { Providers } from './providers';
const inter = Inter({ subsets: ['latin'] });
-export async function generateMetadata(): Promise<Metadata> {
- return buildMetaForDefault({});
-}
-
export function generateStaticParams() {
return getStaticParams();
}
diff --git a/apps/web/src/app/[locale]/page.tsx b/apps/web/src/app/[locale]/page.tsx
index c1de5994..bb00aeed 100644
--- a/apps/web/src/app/[locale]/page.tsx
+++ b/apps/web/src/app/[locale]/page.tsx
@@ -1,15 +1,9 @@
-import type { Metadata } from 'next';
+import { setStaticParamsLocale } from 'next-international/server';
import { Footsies } from '~/components/footsies';
import { Community } from './_components/community/community';
import { Features } from './_components/features';
import { Hero } from './_components/hero';
import { WaitlistBanner } from './_components/waitlist-banner';
-import { setStaticParamsLocale } from 'next-international/server';
-import { buildMetaForDefault } from '../metadata';
-
-export async function generateMetadata(): Promise<Metadata> {
- return buildMetaForDefault({});
-}
export default async function Index({ params: { locale } }: { params: { locale: string } }) {
setStaticParamsLocale(locale);
diff --git a/apps/web/src/app/[locale]/tracks/page.tsx b/apps/web/src/app/[locale]/tracks/page.tsx
index f9093b48..bfff27cb 100644
--- a/apps/web/src/app/[locale]/tracks/page.tsx
+++ b/apps/web/src/app/[locale]/tracks/page.tsx
@@ -4,6 +4,7 @@ import { buildMetaForDefault } from '~/app/metadata';
export async function generateMetadata(): Promise<Metadata> {
return buildMetaForDefault({
title: 'Explore Tracks | TypeHero',
+ description: 'Explore the tracks available on TypeHero.',
});
}
diff --git a/apps/web/src/app/layout.tsx b/apps/web/src/app/layout.tsx
index 85b826d2..31fc7c62 100644
--- a/apps/web/src/app/layout.tsx
+++ b/apps/web/src/app/layout.tsx
@@ -1,9 +1,42 @@
-import type { Metadata } from 'next';
-import { buildMetaForDefault } from './metadata';
+import { OG_URL, tagline } from './metadata';
-export async function generateMetadata(): Promise<Metadata> {
- return buildMetaForDefault({});
-}
+export const metadata = {
+ metadataBase: new URL(OG_URL),
+ title: 'TypeHero',
+ robots: {
+ index: true,
+ follow: true,
+ },
+ description: tagline,
+ openGraph: {
+ title: 'TypeHero',
+ description: tagline,
+ siteName: 'TypeHero',
+ images: [
+ {
+ url: `${OG_URL}/api/default`,
+ width: 1920,
+ height: 1080,
+ },
+ ],
+ locale: 'en-US',
+ type: 'website',
+ },
+ twitter: {
+ title: 'TypeHero',
+ card: 'summary_large_image',
+ images: [
+ {
+ url: `${OG_URL}/api/default`,
+ width: 1920,
+ height: 1080,
+ },
+ ],
+ },
+ icons: {
+ shortcut: '/favicon.ico',
+ },
+};
export default function RootLayout({ children }: { children: React.ReactNode }) {
return children;
diff --git a/apps/web/src/app/metadata.ts b/apps/web/src/app/metadata.ts
index d614575f..ff04a610 100644
--- a/apps/web/src/app/metadata.ts
+++ b/apps/web/src/app/metadata.ts
@@ -1,11 +1,11 @@
import type { Metadata } from 'next';
import { challengeParam, userParam } from '@repo/og-image';
-const OG_URL =
+export const OG_URL =
process.env.NODE_ENV !== 'production' ? 'http://localhost:4200' : 'https://og.typehero.dev';
-const tagline = 'Level up your typescript skills with interactive exercises';
-const baseMetadata: Metadata = {
+export const tagline = 'Level up your TypeScript skills with interactive exercises';
+export const baseMetadata: Metadata = {
metadataBase: new URL(OG_URL),
title: {
default: 'TypeHero',