diff --git a/src/frontend/next/src/components/SEO.tsx b/src/frontend/next/src/components/SEO.tsx new file mode 100644 index 0000000000..6b73f15d82 --- /dev/null +++ b/src/frontend/next/src/components/SEO.tsx @@ -0,0 +1,27 @@ +import Head from 'next/head'; +import { useRouter } from 'next/router'; +import config from '../config'; + +type SEOProps = { + pageTitle: string; +}; + +const SEO = ({ pageTitle }: SEOProps) => { + const { telescopeUrl } = config; + const { pathname } = useRouter(); + const currentUrl = `${telescopeUrl}${pathname}`; + + return ( + + + + + {pageTitle} + + ); +}; + +export default SEO; diff --git a/src/frontend/next/src/config.ts b/src/frontend/next/src/config.ts index 7d77ba5a76..00cc37162b 100644 --- a/src/frontend/next/src/config.ts +++ b/src/frontend/next/src/config.ts @@ -5,4 +5,5 @@ export default { // This comes via the top level .env and its API_URL value, // and gets set in next.config.js at build time. telescopeUrl: process.env.NEXT_PUBLIC_API_URL, + keywords: 'blogfeeds, canada, opensourced', }; diff --git a/src/frontend/next/src/pages/_document.tsx b/src/frontend/next/src/pages/_document.tsx index 431ddd4348..8cb61bc760 100644 --- a/src/frontend/next/src/pages/_document.tsx +++ b/src/frontend/next/src/pages/_document.tsx @@ -3,6 +3,8 @@ import Document, { Html, Head, Main, NextScript, DocumentContext } from 'next/do import { ServerStyleSheets } from '@material-ui/core/styles'; import { logoUrl } from '../components/Logo'; +import config from '../config'; +import lightTheme from '../theme/lightTheme'; // Reference: https://github.com/mui-org/material-ui/blob/master/examples/nextjs/pages/_document.js class MyDocument extends Document { @@ -12,10 +14,30 @@ class MyDocument extends Document { } render() { + const { title, description, author, telescopeUrl, keywords } = config; return ( + + + + + + + + + + + + + + + + + + +