Last active
May 1, 2021 15:09
-
-
Save christianwish/bfb380538af1524c90f90d418b3ed8d7 to your computer and use it in GitHub Desktop.
Head with meta information (nextjs)
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 NextHead from 'next/head'; | |
export const Head = ({ | |
title, | |
image, | |
imageAlt, | |
description, | |
author, | |
keywords, | |
}) => { | |
return <NextHead> | |
{ title | |
&& ( | |
<title> | |
{title} | |
</title> | |
)} | |
{ author ? <meta name="author" content="Anna Lyse" /> : null} | |
{ description ? <meta property="description" content={description} /> : null} | |
{ keywords ? <meta name="keywords" content={keywords} /> : null} | |
{ image ? <meta property="og:image" content={image} /> : null} | |
{ description ? <meta property="og:description" content={description} /> : null} | |
{ title ? <meta property="og:title" content={title} /> : null} | |
{ title ? <meta property="twitter:title" content={title} /> : null} | |
<meta name="twitter:card" content="summary" /> | |
<meta name="twitter:creator" content="@chrisheyntweets" /> | |
{ image ? <meta property="twitter:image" content={image} /> : null} | |
{ imageAlt ? <meta property="twitter:image:alt" content={imageAlt} /> : null} | |
{ description ? <meta property="twitter:description" content={description} /> : null} | |
</NextHead> | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment