import Head from "next/head"; import { MetaInfo } from "../../types/models"; import { useRouter } from "next/router"; import { Layout } from "../Layout"; export function MetaLayout({ metaInfo, children, showBreadcrumb = false, breadcrumbCallback = () => { /* no op */ }, }: { metaInfo: MetaInfo; children: any; showBreadcrumb?: boolean; breadcrumbCallback?: (pathnameArray: string[], asPathArray: string[]) => any; }) { const router = useRouter(); const siteUrl = process.env.SITE_URL; const basePath = process.env.BASEPATH; const title = metaInfo.title.indexOf("Learn Amplify") > -1 ? metaInfo.title : `${metaInfo.title} - Learn Amplify`; const url = `${siteUrl}${basePath}${router.asPath}`; const image = metaInfo.image ? `${siteUrl}${metaInfo.image}` : `${siteUrl}${basePath}/learn-preview.jpg`; return ( <> {title} {children} ); }