import { NextSeo } from 'next-seo'
import { useRouter } from 'next/router'

const Seo = ({ ...props }) => {
  const router = useRouter()

  const { additionalMetaTags = [], openGraph = [], title = '' } = props

  return (
    <NextSeo
      defaultTitle='Indoteknik.com: B2B Industrial Supply & Solution'
      canonical={process.env.NEXT_PUBLIC_SELF_HOST + router.asPath}
      description={title}
      {...props}
      openGraph={{
        siteName: 'Indoteknik.com',
        ...openGraph
      }}
      additionalMetaTags={[
        {
          property: 'fb:app_id',
          content: '270830718811'
        },
        {
          property: 'fb:page_id',
          content: '101759953569'
        },
        ...additionalMetaTags
      ]}
    />
  )
}

export default Seo
