Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: append author handle on og title #38

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>;
Loading