Connect, collaborate, and grow with a community of TypeScript developers
fix:build meta data only if user exits (#797)
sital0025a6c465d9fb0
diff --git a/apps/web/src/app/[locale]/[username]/page.tsx b/apps/web/src/app/[locale]/[username]/page.tsxindex 2183dff9..8f95de7c 100644--- a/apps/web/src/app/[locale]/[username]/page.tsx+++ b/apps/web/src/app/[locale]/[username]/page.tsx@@ -1,4 +1,4 @@-import { buildMetaForUser } from '~/app/metadata';+import { buildMetaForDefault, buildMetaForUser } from '~/app/metadata';import { Profile } from './_components/profile';interface Props {@@ -13,10 +13,14 @@ export default function Page({ params }: Props) {export async function generateMetadata({ params: { username } }: Props) {const name = decodeURIComponent(username).substring(1);-- return buildMetaForUser({- username: name,- title: `${name}'s profile | TypeHero`,- description: `View the profile of ${name} on TypeHero.`,+ if (name)+ return buildMetaForUser({+ username: name,+ title: `${name}'s profile | TypeHero`,+ description: `View the profile of ${name} on TypeHero.`,+ });+ return buildMetaForDefault({+ title: 'Profile | TypeHero',+ description: 'View the profile of a user on TypeHero.',});}