manifold/web/components/SEO.tsx
Marshall Polaris d2273087cf
React 17.0.2 -> 18.2.0 (#1003)
* React 17.0.2 -> 18.2.0

* Adjust title tag to only have one text node (no internal spaces)

* react-expanding-textarea 2.3.5 -> 2.3.6
2022-10-04 23:16:39 -07:00

62 lines
1.4 KiB
TypeScript

import { ReactNode } from 'react'
import Head from 'next/head'
import { Challenge } from 'common/challenge'
import { buildCardUrl, OgCardProps } from 'common/contract-details'
export function SEO(props: {
title: string
description: string
url?: string
children?: ReactNode
ogCardProps?: OgCardProps
challenge?: Challenge
}) {
const { title, description, url, children, ogCardProps, challenge } = props
return (
<Head>
<title>{`${title} | Manifold Markets`}</title>
<meta
property="og:title"
name="twitter:title"
content={title}
key="title"
/>
<meta name="description" content={description} key="description1" />
<meta
property="og:description"
name="twitter:description"
content={description}
key="description2"
/>
{url && (
<meta
property="og:url"
content={'https://manifold.markets' + url}
key="url"
/>
)}
{ogCardProps && (
<>
<meta
property="og:image"
content={buildCardUrl(ogCardProps, challenge)}
key="image1"
/>
<meta name="twitter:card" content="summary_large_image" key="card" />
<meta
name="twitter:image"
content={buildCardUrl(ogCardProps, challenge)}
key="image2"
/>
</>
)}
{children}
</Head>
)
}