import { useRouter } from 'next/router'
import React from 'react'
import { NextSeo } from "next-seo"
import { MetaTag, NextSeoProps } from 'next-seo/lib/types';

export const Seo = (props: NextSeoProps) => {
  const router = useRouter()

  const additionalMetaTags: MetaTag[] = [
    {
      property: 'fb:app_id',
      content: '270830718811'
    },
    {
      property: 'fb:page_id',
      content: '101759953569'
    },
  ]

  if (!!props.additionalMetaTags) additionalMetaTags.push(...props.additionalMetaTags)

  return (
    <NextSeo
      defaultTitle='Indoteknik.com: B2B Industrial Supply & Solution'
      canonical={process.env.NEXT_PUBLIC_SELF_HOST + router.asPath}
      description={props.title}
      {...props}
      openGraph={{ siteName: 'Indoteknik.com', ...props.openGraph }}
      additionalMetaTags={additionalMetaTags}
    />
  )
}