diff --git a/components/CustomFont.tsx b/components/CustomFont.tsx index 619c9f9..7809848 100644 --- a/components/CustomFont.tsx +++ b/components/CustomFont.tsx @@ -1,5 +1,5 @@ +import React from 'react' import Head from 'next/head' -import * as React from 'react' import * as types from '../lib/types' export const CustomFont: React.FC<{ site: types.Site }> = ({ site }) => { diff --git a/components/ErrorPage.tsx b/components/ErrorPage.tsx index 2f5c6d5..e0e2003 100644 --- a/components/ErrorPage.tsx +++ b/components/ErrorPage.tsx @@ -1,5 +1,4 @@ import React from 'react' -import Head from 'next/head' import { PageHead } from './PageHead' import styles from './styles.module.css' @@ -9,14 +8,7 @@ export const ErrorPage: React.FC<{ statusCode: number }> = ({ statusCode }) => { return ( <> - - - - - - - {title} - +
diff --git a/components/Footer.tsx b/components/Footer.tsx index a8dea8a..654d191 100644 --- a/components/Footer.tsx +++ b/components/Footer.tsx @@ -1,4 +1,4 @@ -import * as React from 'react' +import React from 'react' import { FaTwitter, FaZhihu, FaGithub, FaLinkedin } from 'react-icons/fa' import { IoSunnyOutline, IoMoonSharp } from 'react-icons/io5' import * as config from 'lib/config' diff --git a/components/Loading.tsx b/components/Loading.tsx index f78825b..cfdcee8 100644 --- a/components/Loading.tsx +++ b/components/Loading.tsx @@ -1,4 +1,4 @@ -import * as React from 'react' +import React from 'react' import { LoadingIcon } from './LoadingIcon' import styles from './styles.module.css' diff --git a/components/LoadingIcon.tsx b/components/LoadingIcon.tsx index d2561ed..3bcc1f5 100644 --- a/components/LoadingIcon.tsx +++ b/components/LoadingIcon.tsx @@ -1,4 +1,4 @@ -import * as React from 'react' +import React from 'react' import cs from 'classnames' import styles from './styles.module.css' diff --git a/components/NotionPage.tsx b/components/NotionPage.tsx index ddcf9f9..049464e 100644 --- a/components/NotionPage.tsx +++ b/components/NotionPage.tsx @@ -1,5 +1,4 @@ -import * as React from 'react' -import Head from 'next/head' +import React from 'react' import Link from 'next/link' import Image from 'next/image' import dynamic from 'next/dynamic' @@ -154,47 +153,13 @@ export const NotionPage: React.FC = ({ } }} > - - - - - - - - - - {config.twitter && ( - - )} - - {socialDescription && ( - <> - - - - - )} - - {socialImage ? ( - <> - - - - - ) : ( - - )} - - {canonicalPageUrl && ( - <> - - - - - )} - - {title} - + diff --git a/components/Page404.tsx b/components/Page404.tsx index ce988e8..dd30691 100644 --- a/components/Page404.tsx +++ b/components/Page404.tsx @@ -1,5 +1,4 @@ -import Head from 'next/head' -import * as React from 'react' +import React from 'react' import * as types from 'lib/types' import { PageHead } from './PageHead' @@ -10,14 +9,7 @@ export const Page404: React.FC = ({ site, pageId, error }) => { return ( <> - - - - - - - {title} - +
diff --git a/components/PageHead.tsx b/components/PageHead.tsx index 4072159..570b6ce 100644 --- a/components/PageHead.tsx +++ b/components/PageHead.tsx @@ -1,10 +1,20 @@ import Head from 'next/head' -import * as React from 'react' +import React from 'react' + import * as types from 'lib/types' +import * as config from 'lib/config' -// TODO: remove duplication between PageHead and NotionPage Head +export const PageHead: React.FC< + types.PageProps & { + title?: string + description?: string + image?: string + url?: string + } +> = ({ site, title, description, image, url }) => { + title = title ?? site?.name + description = description ?? site?.description -export const PageHead: React.FC = ({ site }) => { return ( @@ -14,15 +24,49 @@ export const PageHead: React.FC = ({ site }) => { content='width=device-width, initial-scale=1, shrink-to-fit=no' /> - {site?.description && ( + + + + {site && ( <> - - + + )} - - + {config.twitter && ( + + )} + + {description && ( + <> + + + + + )} + + {image ? ( + <> + + + + + ) : ( + + )} + + {url && ( + <> + + + + + )} + + + + {title} ) } diff --git a/lib/config.ts b/lib/config.ts index b2c2ad8..7284330 100644 --- a/lib/config.ts +++ b/lib/config.ts @@ -51,15 +51,6 @@ export const zhihu: string | null = getSiteConfig('zhihu', null) export const github: string | null = getSiteConfig('github', null) export const linkedin: string | null = getSiteConfig('linkedin', null) -export const socialImageTitle: string | null = getSiteConfig( - 'socialImageTitle', - null -) -export const socialImageSubtitle: string | null = getSiteConfig( - 'socialImageSubtitle', - null -) - // default notion values for site-wide consistency (optional; may be overridden on a per-page basis) export const defaultPageIcon: string | null = getSiteConfig( 'defaultPageIcon', diff --git a/site.config.js b/site.config.js index 3280c74..08c1469 100644 --- a/site.config.js +++ b/site.config.js @@ -8,13 +8,11 @@ export default { // basic site info (required) name: 'Transitive Bullshit', - domain: 'transitivebullsh.it', + domain: 'nextjs-notion-starter-kit.transitivebullsh.it', author: 'Travis Fischer', // open graph metadata (optional) - description: 'Example site description', - socialImageTitle: 'Transitive Bullshit', - socialImageSubtitle: 'Hello World! 👋', + description: 'Example Next.js Notion Starter Kit Site', // social usernames (optional) twitter: 'transitive_bs',