Created
May 31, 2023 22:41
-
-
Save douglas-henrique/2f7d40874d39b03f97a6f591f8bb4bf3 to your computer and use it in GitHub Desktop.
Next JS generateMetadata function to twitter opengraph
This file contains hidden or 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
export async function generateMetadata( | |
{ params }: { params: { slug: string } }): Promise<Metadata> { | |
const data: PostFullProps = await getData(params.slug); | |
return { | |
title: 'title of your page', | |
metadataBase: new URL("YOUR_BASE_URL"), | |
description: 'page description', | |
keywords: [], | |
authors: [{ name: 'YOUR NAME' }], | |
creator: 'YOUR NAME' , | |
publisher: 'YOUR NAME' , | |
openGraph: { | |
images: [''], | |
description: 'page description', | |
type: 'article', | |
url: 'YOUR_BASE_URL' + params.slug, | |
title: 'title of your page', | |
}, | |
twitter: { | |
images: [''], | |
card: 'summary_large_image', | |
title: 'title of your page', | |
description: 'page description', | |
} | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment