Skip to content

Commit 38f8b6f

Browse files
committed
fix: og metadata
1 parent 12fc740 commit 38f8b6f

File tree

2 files changed

+61
-3
lines changed
  • apps/arkmarket/src/app

2 files changed

+61
-3
lines changed

apps/arkmarket/src/app/[collectionAddress]/[tokenId]/page.tsx

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,56 @@
11
import { notFound } from "next/navigation";
2-
import { ChainId, CollectionAddresses } from "~/config/homepage";
2+
import { ChainId, CollectionAddresses, Collections } from "~/config/homepage";
33
import TokenPage from "~/app/token/[contractAddress]/[tokenId]/page";
4+
import type { Metadata } from "next";
5+
import getCollection from "~/lib/getCollection";
6+
import { env } from "~/env";
7+
8+
interface GenerateMetadataProps {
9+
params: Promise<{ collectionAddress: string }>;
10+
}
11+
12+
export async function generateMetadata({
13+
params,
14+
}: GenerateMetadataProps): Promise<Metadata> {
15+
const collection = CollectionAddresses[params.collectionAddress];
16+
const collectionAddress = collection[ChainId.SN_MAIN];
17+
if (collectionAddress === CollectionAddresses[Collections.ETERNUMSEASONPASS][ChainId.SN_MAIN]) {
18+
return {
19+
title: `Eternum Season 0 Pass`,
20+
description: 'Conquer the Realms',
21+
openGraph: {
22+
images: [
23+
{
24+
url: `https://market.realms.world/og/eternum-season-pass.png`,
25+
width: 1200,
26+
height: 630,
27+
},
28+
],
29+
},
30+
twitter: {
31+
images: [
32+
{
33+
url: `https://market.realms.world/og/eternum-season-pass.png`,
34+
width: 1200,
35+
height: 630,
36+
},
37+
],
38+
},
39+
}
40+
}
41+
const platform =
42+
env.NEXT_PUBLIC_THEME === "unframed" ? "Unframed" : "Ark Market";
43+
const name = collection?.name ?? "Collection";
44+
45+
return {
46+
title: `${name} | ${platform}`,
47+
openGraph: {
48+
images: [
49+
`https://ark-market-unframed.vercel.app/api/og/collection?collection_address=${collectionAddress}`,
50+
],
51+
},
52+
};
53+
}
454

555
export default function TokenPageRoute({ params }) {
656
const collection = CollectionAddresses[params.collectionAddress];

apps/arkmarket/src/app/collection/[collectionAddress]/page.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,20 @@ export async function generateMetadata({
2424
description: 'Conquer the Realms',
2525
openGraph: {
2626
images: [
27-
`https://market.realms.world/og/eternum-season-pass.png`,
27+
{
28+
url: `https://market.realms.world/og/eternum-season-pass.png`,
29+
width: 1200,
30+
height: 630,
31+
},
2832
],
2933
},
3034
twitter: {
3135
images: [
32-
`https://market.realms.world/og/eternum-season-pass.png`,
36+
{
37+
url: `https://market.realms.world/og/eternum-season-pass.png`,
38+
width: 1200,
39+
height: 630,
40+
},
3341
],
3442
},
3543
}

0 commit comments

Comments
 (0)