Last active
September 28, 2022 19:55
-
-
Save scastiel/d127d5db7bf34e86cb5798cdc6ace5e3 to your computer and use it in GitHub Desktop.
SeoHeaders.ts
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
import Head from 'next/head' | |
export const SeoHeaders = ({ | |
title, | |
description, | |
author, | |
twitterAuthor, | |
twitterSite, | |
url, | |
imageUrl, | |
}: { | |
title: string | |
description: string | |
author: string | |
twitterAuthor: string | |
twitterSite: string | |
url?: string | |
imageUrl: string | |
}) => { | |
return ( | |
<Head> | |
<title>{title}</title> | |
{url && <link rel="canonical" href={url} />} | |
<meta name="description" content={description} /> | |
<meta name="author" content={author} /> | |
<meta name="robots" content="index,follow" /> | |
<meta property="og:title" content={title} /> | |
<meta property="og:type" content="website" /> | |
<meta property="og:image" content={imageUrl} /> | |
{url && <meta property="og:url" content={url} />} | |
<meta property="og:description" content={description} /> | |
<meta name="twitter:card" content="summary_large_image" /> | |
<meta name="twitter:author" content={twitterAuthor} /> | |
<meta name="twitter:site" content={twitterSite} /> | |
{url && <meta name="twitter:url" content={url} />} | |
<meta name="twitter:title" content={title} /> | |
<meta name="twitter:image" content={imageUrl} /> | |
<meta name="twitter:description" content={description} /> | |
</Head> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment