import Head from "next/head" import { useRouter } from "next/router" import { DrupalMetatag } from "types/drupal" interface MetaProps { title?: string path?: string tags?: DrupalMetatag[] } export function Meta({ title, tags }: MetaProps) { const router = useRouter() return ( {tags?.length ? ( tags.map((tag, index) => { if (tag.attributes.rel === "canonical") { return null } if (tag.attributes.name === "title") { return ( {tag.attributes.content} ) } const Tag = tag.tag as keyof JSX.IntrinsicElements return }) ) : ( <> {`${title} | Next.js for Drupal`} )} ) }