Skip to content

Commit

Permalink
fix: append author handle on og title
Browse files Browse the repository at this point in the history
  • Loading branch information
dudu0506 committed Sep 19, 2024
1 parent 070fc39 commit 5f2abf8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/app/polls/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export async function generateMetadata({ params, searchParams }: PageProps): Pro
const metadata = await fetchMetadata(new URL(urlcat('/api/frames', queryData), env.external.NEXT_PUBLIC_HOST));
const poll = await getPoll(queryData.id, queryData.source, queryData.profileId);
const ogImage = (metadata?.['of:image'] || `${env.external.NEXT_PUBLIC_HOST}/firefly.png`) as string;
const ogTitle = queryData.handle ? `Polls from @${queryData.handle} via Firefly` : COMMON_APP_TITLE;

if (metadata) {
// update this to support hey.xyz
Expand All @@ -31,10 +32,10 @@ export async function generateMetadata({ params, searchParams }: PageProps): Pro
}

return {
title: COMMON_APP_TITLE,
title: ogTitle,
other: { ...metadata },
openGraph: {
title: COMMON_APP_TITLE,
title: ogTitle,
description: poll?.title || 'Everything app for Web3 natives',
images: [ogImage],
},
Expand Down
1 change: 1 addition & 0 deletions src/constants/zod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ export const IMAGE_QUERY_SCHEMA = z.object({
locale: z.nativeEnum(LOCALE).optional().default(LOCALE.en).catch(LOCALE.en),
source: z.nativeEnum(FRAME_SOURCE).default(FRAME_SOURCE.Farcaster),
author: z.string().optional(),
handle: z.string().optional(),
});
export type ImageQuery = z.infer<typeof IMAGE_QUERY_SCHEMA>;

0 comments on commit 5f2abf8

Please sign in to comment.