diff --git a/components/core/Head/Head.tsx b/components/core/Head/Head.tsx new file mode 100644 index 000000000..b2c0c997b --- /dev/null +++ b/components/core/Head/Head.tsx @@ -0,0 +1,18 @@ +import { FC } from 'react' +import NextHead from 'next/head' +import { DefaultSeo } from 'next-seo' +import config from '@config/seo.json' + +const Head: FC = () => { + return ( + <> + + + + + + + ) +} + +export default Head diff --git a/components/core/Head/index.ts b/components/core/Head/index.ts new file mode 100644 index 000000000..b317a124b --- /dev/null +++ b/components/core/Head/index.ts @@ -0,0 +1 @@ +export { default } from './Head' diff --git a/components/core/index.ts b/components/core/index.ts index 587c9cece..27b19d5d8 100644 --- a/components/core/index.ts +++ b/components/core/index.ts @@ -6,3 +6,4 @@ export { default as Navbar } from './Navbar' export { default as Searchbar } from './Searchbar' export { default as UserNav } from './UserNav' export { default as Toggle } from './Toggle' +export { default as Head } from './Head' diff --git a/config.json b/config.json deleted file mode 100644 index 6c279ee04..000000000 --- a/config.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "seo": { - "title": "ACME Storefront | Powered by Next.js Commerce", - "titleTemplate": "%s - ACME Storefront", - "description": "Next.js Commerce -> https://www.nextjs.org/commerce", - "openGraph": { - "type": "website", - "locale": "en_IE", - "url": "https://nextjs.org/commerce", - "site_name": "Next.js Commerce" - }, - "twitter": { - "handle": "@nextjs", - "site": "@nextjs", - "cardType": "summary_large_image" - } - } -} diff --git a/config/seo.json b/config/seo.json new file mode 100644 index 000000000..0d0c3d37d --- /dev/null +++ b/config/seo.json @@ -0,0 +1,16 @@ +{ + "title": "ACME Storefront | Powered by Next.js Commerce", + "titleTemplate": "%s - ACME Storefront", + "description": "Next.js Commerce -> https://www.nextjs.org/commerce", + "openGraph": { + "type": "website", + "locale": "en_IE", + "url": "https://nextjs.org/commerce", + "site_name": "Next.js Commerce" + }, + "twitter": { + "handle": "@nextjs", + "site": "@nextjs", + "cardType": "summary_large_image" + } +} diff --git a/pages/_app.tsx b/pages/_app.tsx index 0339d477f..683e07139 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -3,11 +3,9 @@ import '@assets/tailwind.css' import '@assets/utils.css' import 'animate.css' import { FC } from 'react' -import { DefaultSeo } from 'next-seo' + import type { AppProps } from 'next/app' -import config from '../config.json' -import Head from 'next/head' import { CommerceProvider } from '@lib/bigcommerce' const Noop: FC = ({ children }) => <>{children} @@ -17,11 +15,6 @@ export default function MyApp({ Component, pageProps }: AppProps) { return ( <> - - - - - diff --git a/tsconfig.json b/tsconfig.json index 4760611cc..e6b6b9c9c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -18,7 +18,8 @@ "@lib/*": ["lib/*"], "@assets/*": ["assets/*"], "@components/*": ["components/*"], - "@utils/*": ["utils/*"] + "@utils/*": ["utils/*"], + "@config/*": ["config/*"] } }, "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "**/*.js"],