Merge pull request #6 from neynarxyz/grin/fix-share-page

fix share page
This commit is contained in:
grin 2025-05-30 16:42:32 -04:00 committed by GitHub
commit 9cd07170b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,4 +1,4 @@
import { Metadata } from "next"; import type { Metadata } from "next";
import { redirect } from "next/navigation"; import { redirect } from "next/navigation";
import { APP_URL, APP_NAME, APP_DESCRIPTION } from "~/lib/constants"; import { APP_URL, APP_NAME, APP_DESCRIPTION } from "~/lib/constants";
import { getFrameEmbedMetadata } from "~/lib/utils"; import { getFrameEmbedMetadata } from "~/lib/utils";
@ -7,8 +7,12 @@ export const revalidate = 300;
// This is an example of how to generate a dynamically generated share page based on fid: // This is an example of how to generate a dynamically generated share page based on fid:
// Sharing this route e.g. exmaple.com/share/123 will generate a share page for fid 123, // Sharing this route e.g. exmaple.com/share/123 will generate a share page for fid 123,
// with the image dynamically generated by the opengraph-image API route. // with the image dynamically generated by the opengraph-image API route.
export async function generateMetadata({ params }: { params: { fid: string } }): Promise<Metadata> { export async function generateMetadata({
const fid = params.fid; params,
}: {
params: Promise<{ fid: string }>;
}): Promise<Metadata> {
const { fid } = await params;
const imageUrl = `${APP_URL}/api/opengraph-image?fid=${fid}`; const imageUrl = `${APP_URL}/api/opengraph-image?fid=${fid}`;
return { return {
@ -27,4 +31,4 @@ export async function generateMetadata({ params }: { params: { fid: string } }):
export default function SharePage() { export default function SharePage() {
// redirect to home page // redirect to home page
redirect("/"); redirect("/");
} }