-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #323 from kodadot/ogi-feat--opengraph-for-base-net…
…work feat: opengraph for base network
- Loading branch information
Showing
5 changed files
with
2,819 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<template> | ||
<div> | ||
<p>address: {{ address }}</p> | ||
<p>token: {{ token }}</p> | ||
{{ item }} | ||
<div> | ||
<p>image:</p> | ||
<img :src="image" :alt="item.metadata.name" /> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import { createThirdwebClient, getContract } from 'thirdweb' | ||
import { base } from 'thirdweb/chains'; | ||
import { getNFT } from 'thirdweb/extensions/erc721' | ||
const router = useRouter() | ||
const id = router.currentRoute.value.params.id.toString().split('-') | ||
const address = id[0] | ||
const token = id[1] as unknown as bigint | ||
const client = createThirdwebClient({ | ||
clientId: 'd0455344acaa6fb760281466980f3ec6' | ||
}) | ||
const contract = getContract({ | ||
client, | ||
chain: base, | ||
address: address, | ||
}) | ||
const item = await getNFT({ | ||
contract, | ||
tokenId: token | ||
}) | ||
const imageUri = item.metadata.image || 'https://koda.art/k_card.png' | ||
const image = useState(() => '') | ||
// ensure to callOnce to avoid missmatch content between ssr/csr | ||
await callOnce(async () => image.value = await parseImage(imageUri, false)) | ||
defineOgImage({ | ||
component: 'gallery', | ||
props: { | ||
title: item.metadata.name, | ||
image, | ||
network: 'base' | ||
} | ||
}) | ||
useSeoMeta({ | ||
title: seoTitle(item.metadata.name), | ||
description: item.metadata.description, | ||
ogTitle: seoTitle(item.metadata.name), | ||
ogDescription: item.metadata.description, | ||
ogType: 'website', | ||
twitterCard: 'summary_large_image', | ||
twitterTitle: seoTitle(item.metadata.name), | ||
twitterImageAlt: item.metadata.name, | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export const seoTitle = (title: string) => { | ||
export const seoTitle = (title='') => { | ||
return `${title} | Generative Art Marketplace` | ||
} |
Oops, something went wrong.