From a8cd2d568f82cf2f02cbf5eac301c127d0e199d5 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 14 Feb 2026 02:22:42 +0000 Subject: [PATCH 1/3] Add dynamic SEO metadata to join group page - Replace static metadata with generateMetadata function - Fetch group name and include it in page title - Add descriptive meta description with group name - Fallback to generic title if group not found https://claude.ai/code/session_kODnY --- app/(standalone)/join/[groupId]/page.tsx | 34 ++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/app/(standalone)/join/[groupId]/page.tsx b/app/(standalone)/join/[groupId]/page.tsx index b255b66..3e06070 100644 --- a/app/(standalone)/join/[groupId]/page.tsx +++ b/app/(standalone)/join/[groupId]/page.tsx @@ -25,8 +25,38 @@ import { QueryOrigin } from '@/constants' import JoinGroupForm from './_components/join-group-form' import { Path } from '@/lib/utils/path' -export const metadata: Metadata = { - title: 'Join Group', +export async function generateMetadata({ + params, +}: { + params: Promise<{ groupId: string }> +}): Promise { + const { groupId } = await params + + if (!groupId) { + return { + title: 'Join Group', + } + } + + const group = await db.query.groupsTable.findFirst({ + where(fields, operators) { + return operators.eq(fields.id, groupId) + }, + columns: { + name: true, + }, + }) + + if (!group) { + return { + title: 'Join Group', + } + } + + return { + title: `Join ${group.name}`, + description: `Join ${group.name} to tip on Formula 1 races with the group members.`, + } } export default async function JoinGroup({ From 2dac374a5b1c4cfd00c56e2c0bb23226d4c035d3 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 14 Feb 2026 02:26:31 +0000 Subject: [PATCH 2/3] Refactor: use existing getGroup method in generateMetadata - Move getGroup function to module level - Reuse getGroup in both generateMetadata and JoinGroup component - Remove duplicate database query logic https://claude.ai/code/session_kODnY --- app/(standalone)/join/[groupId]/page.tsx | 33 ++++++++++-------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/app/(standalone)/join/[groupId]/page.tsx b/app/(standalone)/join/[groupId]/page.tsx index 3e06070..0a7c67f 100644 --- a/app/(standalone)/join/[groupId]/page.tsx +++ b/app/(standalone)/join/[groupId]/page.tsx @@ -25,6 +25,18 @@ import { QueryOrigin } from '@/constants' import JoinGroupForm from './_components/join-group-form' import { Path } from '@/lib/utils/path' +function getGroup(id: Database.Group['id']) { + return db.query.groupsTable.findFirst({ + where(fields, operators) { + return operators.eq(fields.id, id) + }, + columns: { + name: true, + iconName: true, + }, + }) +} + export async function generateMetadata({ params, }: { @@ -38,14 +50,7 @@ export async function generateMetadata({ } } - const group = await db.query.groupsTable.findFirst({ - where(fields, operators) { - return operators.eq(fields.id, groupId) - }, - columns: { - name: true, - }, - }) + const group = await getGroup(groupId) if (!group) { return { @@ -172,18 +177,6 @@ export default async function JoinGroup({ })) } - function getGroup(id: Database.Group['id']) { - return db.query.groupsTable.findFirst({ - where(fields, operators) { - return operators.eq(fields.id, id) - }, - columns: { - name: true, - iconName: true, - }, - }) - } - function EmptyState() { return ( From bbb172399d52d2a1deb113735098ae2a172057f5 Mon Sep 17 00:00:00 2001 From: Joschua <70809675+selfire1@users.noreply.github.com> Date: Sat, 14 Feb 2026 12:35:39 +1000 Subject: [PATCH 3/3] move to bottom --- app/(standalone)/join/[groupId]/page.tsx | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/app/(standalone)/join/[groupId]/page.tsx b/app/(standalone)/join/[groupId]/page.tsx index 0a7c67f..bb3790a 100644 --- a/app/(standalone)/join/[groupId]/page.tsx +++ b/app/(standalone)/join/[groupId]/page.tsx @@ -25,18 +25,6 @@ import { QueryOrigin } from '@/constants' import JoinGroupForm from './_components/join-group-form' import { Path } from '@/lib/utils/path' -function getGroup(id: Database.Group['id']) { - return db.query.groupsTable.findFirst({ - where(fields, operators) { - return operators.eq(fields.id, id) - }, - columns: { - name: true, - iconName: true, - }, - }) -} - export async function generateMetadata({ params, }: { @@ -215,3 +203,15 @@ export default async function JoinGroup({ ) } } + +function getGroup(id: Database.Group['id']) { + return db.query.groupsTable.findFirst({ + where(fields, operators) { + return operators.eq(fields.id, id) + }, + columns: { + name: true, + iconName: true, + }, + }) +}