import Head from 'next/head'
import { useRouter } from 'next/router'

const defaultTitle = 'Estudio'

type SEOProps = {
  title?: string
}

const SEO: React.FC<SEOProps> = ({ title }) => {
  const t = title ? `${title} | ${defaultTitle}` : defaultTitle
  const router = useRouter()

  return (
    <Head>
      <title>{t}</title>
      <link rel="icon" href="/favicon.ico" />
      <meta property="og:title" content={t} key="ogtitle" />
      <meta property="og:url" content={`${router.pathname}`} />
    </Head>
  )
}

export default SEO
