update: use fallback og image for local

This commit is contained in:
Rishi 2025-05-12 15:47:12 +02:00
parent 3a6e157db7
commit 47e3f1ff24
1 changed files with 24 additions and 11 deletions

View File

@ -13,6 +13,7 @@ export async function generateMetadata({ params }): Promise<Metadata> {
},
};
try {
const threadData = await getThread(threadId);
const projectData = await getProject(threadData.project_id);
@ -21,19 +22,31 @@ export async function generateMetadata({ params }): Promise<Metadata> {
return fallbackMetaData;
}
const isDevelopment =
process.env.NODE_ENV === 'development' ||
process.env.NEXT_PUBLIC_ENV_MODE === 'LOCAL' ||
process.env.NEXT_PUBLIC_ENV_MODE === 'local';
const title = projectData.name || 'Shared Conversation | Kortix Suna';
const description = projectData.description || 'Replay this Agent conversation on Kortix Suna';
const ogImage = isDevelopment
? `${process.env.NEXT_PUBLIC_URL}/share-page/og-fallback.png`
: `${process.env.NEXT_PUBLIC_URL}/api/share-page/og-image?title=${projectData.name}`;
return {
title: projectData.name || 'Shared Conversation | Kortix Suna',
description:
projectData.description ||
'Replay this Agent conversation on Kortix Suna',
title,
description,
openGraph: {
title: projectData.name || 'Shared Conversation | Kortix Suna',
description:
projectData.description ||
'Replay this Agent conversation on Kortix Suna',
images: [
`${process.env.NEXT_PUBLIC_URL}/api/share-page/og-image?title=${projectData.name}`,
],
title,
description,
images: [ogImage],
},
twitter: {
title,
description,
images: ogImage,
creator: '@kortixai',
card: 'summary_large_image',
},
};
} catch (error) {