import { ReactNode } from 'react' import Head from 'next/head' export type OgCardProps = { question: string probability?: string metadata: string creatorName: string creatorUsername: string creatorAvatarUrl?: string } function buildCardUrl(props: OgCardProps) { const probabilityParam = props.probability === undefined ? '' : `&probability=${encodeURIComponent(props.probability ?? '')}` const creatorAvatarUrlParam = props.creatorAvatarUrl === undefined ? '' : `&creatorAvatarUrl=${encodeURIComponent(props.creatorAvatarUrl ?? '')}` // URL encode each of the props, then add them as query params return ( `https://manifold-og-image.vercel.app/m.png` + `?question=${encodeURIComponent(props.question)}` + probabilityParam + `&metadata=${encodeURIComponent(props.metadata)}` + `&creatorName=${encodeURIComponent(props.creatorName)}` + creatorAvatarUrlParam + `&creatorUsername=${encodeURIComponent(props.creatorUsername)}` ) } export function SEO(props: { title: string description: string url?: string children?: ReactNode ogCardProps?: OgCardProps }) { const { title, description, url, children, ogCardProps } = props return ( {title} | Manifold Markets {url && ( )} {ogCardProps && ( <> )} {children} ) }