Skip to content

Commit

Permalink
add opengraph to token pages
Browse files Browse the repository at this point in the history
  • Loading branch information
saml33 committed Feb 8, 2024
1 parent d34806e commit 3048939
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 2 deletions.
15 changes: 15 additions & 0 deletions app/(pages)/explore/tokens/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,21 @@ export async function generateMetadata(
return {
title: tokenPage.seoTitle,
description: tokenPage.seoDescription,
openGraph: {
title: tokenPage?.seoTitle || tokenPage.tokenName,
description: tokenPage?.seoDescription || tokenPage.symbol,
url: `https://mango.markets/explore/tokens/${tokenPage.slug}`,
siteName: 'Mango Markets',
images: [
{
url: tokenPage.metaImageUrl, // Must be an absolute URL
width: 1200,
height: 600,
},
],
locale: 'en_US',
type: 'website',
},
}
}

Expand Down
2 changes: 2 additions & 0 deletions contentful/tokenPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export interface TokenPage {
coingeckoId: string
seoTitle: string
seoDescription: string
metaImageUrl: string
perpSymbol: string | undefined
spotSymbol: string
lastModified: string
Expand Down Expand Up @@ -58,6 +59,7 @@ export function parseContentfulTokenPage(
seoTitle: tokenPageEntry.fields.seoTitle,
seoDescription: tokenPageEntry.fields.seoDescription,
perpSymbol: tokenPageEntry.fields.perpSymbol || undefined,
metaImageUrl: tokenPageEntry.fields.metaImageUrl,
spotSymbol: tokenPageEntry.fields.spotSymbol,
lastModified: tokenPageEntry.sys.updatedAt,
erc20TokenDecimals: tokenPageEntry.fields.erc20TokenDecimals || undefined,
Expand Down
8 changes: 7 additions & 1 deletion contentful/types/TypeHomePageAnnouncement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ export interface TypeHomePageAnnouncementFields {
description?: EntryFieldTypes.Symbol
linkPath: EntryFieldTypes.Symbol
image?: EntryFieldTypes.AssetLink
category: EntryFieldTypes.Symbol<'Announcement' | 'New Listing' | 'News'>
category: EntryFieldTypes.Symbol<
| 'Announcement'
| 'From the Blog'
| 'New Listing'
| 'News'
| 'So Hot Right Now'
>
}

export type TypeHomePageAnnouncementSkeleton = EntrySkeletonType<
Expand Down
4 changes: 3 additions & 1 deletion contentful/types/TypeLearnPost.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ export interface TypeLearnPostFields {
postTitle: EntryFieldTypes.Symbol
slug: EntryFieldTypes.Symbol
author?: EntryFieldTypes.Symbol
category: EntryFieldTypes.Symbol<'Repost' | 'Spot Trading'>
category: EntryFieldTypes.Symbol<
'Listing on Mango' | 'Repost' | 'Spot Trading'
>
authorProfileImage?: EntryFieldTypes.AssetLink
postDescription: EntryFieldTypes.Text
postContent: EntryFieldTypes.RichText
Expand Down
1 change: 1 addition & 0 deletions contentful/types/TypeToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export interface TypeTokenFields {
perpSymbol?: EntryFieldTypes.Symbol
ethMint?: EntryFieldTypes.Symbol
erc20TokenDecimals?: EntryFieldTypes.Integer
metaImageUrl: EntryFieldTypes.Symbol
}

export type TypeTokenSkeleton = EntrySkeletonType<TypeTokenFields, 'token'>
Expand Down
Binary file added public/images/tokens/social/nos-1200x600.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3048939

Please sign in to comment.