All files / components MetaData.tsx

71.42% Statements 5/7
50% Branches 2/4
50% Functions 1/2
66.66% Lines 4/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 744x                                           4x 3x                                                                                                 4x  
import Head from 'next/head'
 
interface Content {
  title: string
  desc: string
  author: string
  keywords: string
  creator: string
  accessRights: string
  service: string
}
 
export interface Data {
  data_en: Content
  data_fr: Content
}
 
interface MetaDataProps {
  language: string
  data: Data
}
 
const MetaData = ({ language, data }: MetaDataProps) => {
  const d = language === 'en' ? data.data_en : data.data_fr
 
  return (
    <>
      <Head>
        <style jsx>
          {`
            html {
              animation: fouc-fix 0.001s steps(1);
            }
            @keyframes fouc-fix {
              0% {
                visibility: hidden;
              }
              100% {
                visibility: visible;
              }
            }
          `}
        </style>
 
        <title>{d.title}</title>
 
        <meta charSet="utf-8" />
        <meta name="description" content={d.desc} />
        <meta name="author" content={d.author} />
        <meta name="keywords" content={d.keywords} />
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <link rel="icon" href="/favicon.ico" />
        <meta name="dcterms.title" content={d.title} />
        <meta
          name="dcterms.language"
          content={language === 'en' ? 'eng' : 'fra'}
        />
        <meta name="dcterms.creator" content={d.creator} />
        <meta name="dcterms.accessRights" content={d.accessRights} />
        <meta name="dcterms.service" content={d.service} />
      </Head>
    </>
  )
}
 
/* istanbul ignore next */
export async function getStaticProps({ locale }: { locale: string }) {
  return {
    props: { locale },
  }
}
 
export default MetaData