Skip to content

Commit 9b3f88d

Browse files
remove default opengraph image
1 parent 908666e commit 9b3f88d

File tree

2 files changed

+12
-46
lines changed

2 files changed

+12
-46
lines changed

packages/web/src/app/[domain]/chat/[id]/opengraph-image.tsx

Lines changed: 3 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { ImageResponse } from 'next/og';
2+
import { notFound } from 'next/navigation';
23
import { prisma } from '@/prisma';
34
import { getOrgFromDomain } from '@/data/org';
45
import { ChatVisibility } from '@sourcebot/db';
@@ -23,7 +24,7 @@ export default async function Image({ params }: ImageProps) {
2324

2425
const org = await getOrgFromDomain(domain);
2526
if (!org) {
26-
return generateDefaultImage();
27+
notFound();
2728
}
2829

2930
const chat = await prisma.chat.findUnique({
@@ -43,7 +44,7 @@ export default async function Image({ params }: ImageProps) {
4344

4445
// Only generate custom OG images for public chats
4546
if (!chat || chat.visibility !== ChatVisibility.PUBLIC) {
46-
return generateDefaultImage();
47+
notFound();
4748
}
4849

4950
const MAX_CHAT_NAME_LENGTH = 40;
@@ -179,45 +180,3 @@ export default async function Image({ params }: ImageProps) {
179180
}
180181
);
181182
}
182-
183-
function generateDefaultImage() {
184-
return new ImageResponse(
185-
(
186-
<div
187-
style={{
188-
height: '100%',
189-
width: '100%',
190-
display: 'flex',
191-
flexDirection: 'column',
192-
alignItems: 'center',
193-
justifyContent: 'center',
194-
backgroundColor: '#09090b',
195-
fontFamily: 'system-ui, sans-serif',
196-
}}
197-
>
198-
<div
199-
style={{
200-
display: 'flex',
201-
alignItems: 'center',
202-
backgroundColor: '#18181b',
203-
borderRadius: '16px',
204-
padding: '24px 40px',
205-
}}
206-
>
207-
<span
208-
style={{
209-
fontSize: '48px',
210-
fontWeight: 600,
211-
color: '#fafafa',
212-
}}
213-
>
214-
sourcebot.dev
215-
</span>
216-
</div>
217-
</div>
218-
),
219-
{
220-
...size,
221-
}
222-
);
223-
}

packages/web/src/app/[domain]/chat/[id]/page.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,20 @@ export async function generateMetadata({ params }: PageProps): Promise<Metadata>
4343
},
4444
});
4545

46-
// Only show detailed metadata for public chats
47-
if (!chat || chat.visibility !== ChatVisibility.PUBLIC) {
46+
if (!chat) {
4847
return {
4948
title: 'Chat | Sourcebot',
5049
};
5150
}
5251

52+
// Only show detailed metadata for public chats
53+
if (chat.visibility !== ChatVisibility.PUBLIC) {
54+
return {
55+
title: 'Private Chat | Sourcebot',
56+
description: 'Login to view',
57+
};
58+
}
59+
5360
const chatName = chat.name ?? 'Untitled chat';
5461
const messages = chat.messages as unknown as SBChatMessage[];
5562
const firstUserMessage = messages.find(m => m.role === 'user');

0 commit comments

Comments
 (0)