Skip to content

Commit

Permalink
Merge pull request #472 from reservoirprotocol/armando/grwth-4027-upd…
Browse files Browse the repository at this point in the history
…ate-explorer-collectionasset-og-image-to-serve-a-similiar

WIP: Update token image to serve a more dynamic image
  • Loading branch information
r3lays authored Feb 13, 2024
2 parents eeab881 + 94818d0 commit 7daa9af
Show file tree
Hide file tree
Showing 6 changed files with 1,088 additions and 14 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"@reservoir0x/reservoir-kit-ui": "1.25.7",
"@sentry/nextjs": "^7.85.0",
"@types/uuid": "^9.0.1",
"@vercel/og": "^0.5.20",
"dayjs": "^1.11.6",
"eslint-config-next": "^14.1.0",
"framer-motion": "^6.3.6",
Expand Down
12 changes: 11 additions & 1 deletion pages/[chain]/asset/[assetId].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,14 @@ const IndexPage: NextPage<Props> = ({ assetId, ssr }) => {
? token.token.name
: `${token?.token?.tokenId} - ${token?.token?.collection?.name}`

const base64EncodedToken = btoa(JSON.stringify(token))

return (
<Layout>
<Head
ogImage={token?.token?.image || collection?.banner}
ogImage={`/api/og/token?token=${encodeURIComponent(
base64EncodedToken
)}`}
title={pageTitle}
description={collection?.description as string}
metatags={
Expand Down Expand Up @@ -272,6 +276,12 @@ const IndexPage: NextPage<Props> = ({ assetId, ssr }) => {
</>
}
/>
<meta
name="twitter:image"
content={`/api/og/token?token=${encodeURIComponent(
base64EncodedToken
)}`}
/>
<Flex
justify="center"
css={{
Expand Down
Loading

0 comments on commit 7daa9af

Please sign in to comment.