Skip to content

Commit

Permalink
update metadata titles for document forking
Browse files Browse the repository at this point in the history
  • Loading branch information
ibastawisi committed Jan 20, 2025
1 parent 2f4d1af commit 821d7c5
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/app/(appLayout)/new/[[...id]]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@ export async function generateMetadata(
const document = await findUserDocument(params.id[0], searchParams.v);
if (document) {
if (document.collab || document.published) {
metadata.title = document.name;
metadata.title = `Fork ${document.name}`;
metadata.subtitle = `Last updated: ${new Date(document.updatedAt).toLocaleString()}`;
metadata.user = { name: document.author.name, image: document.author.image!, email: document.author.email };
} else {
metadata.title = 'Private Document';
metadata.subtitle = 'if you have access, please sign in to fork it';
metadata.title = 'Fork a Document';
}
} else {
metadata.subtitle = 'Document not found';
metadata.title = 'Fork a Document';
}
const { title, subtitle, description } = metadata;
const image = `/api/og?metadata=${encodeURIComponent(JSON.stringify(metadata))}`;
Expand Down

0 comments on commit 821d7c5

Please sign in to comment.