Skip to content

Commit a99ad8d

Browse files
committed
feat(website): add Head to component page
1 parent 97bbb92 commit a99ad8d

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

website/pages/[component].tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { allDocs, Doc } from 'contentlayer/generated';
22
import type { GetStaticPaths, GetStaticProps } from 'next';
33
import { useMDXComponent } from 'next-contentlayer/hooks';
4+
import Head from 'next/head';
45
import { useRouter } from 'next/router';
56

67
import components from '~/modules/docs/components';
@@ -19,6 +20,10 @@ export default function Component({ docs }: Props) {
1920

2021
return (
2122
<div className='p-10'>
23+
<Head>
24+
<title>{doc.title}</title>
25+
<meta name='description' content={doc.intro} />
26+
</Head>
2227
<article className='prose max-w-none'>
2328
<h1>{doc.title}</h1>
2429
<p>{doc.intro}</p>

website/pages/_app.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { Doc } from 'contentlayer/generated';
22
import type { AppProps } from 'next/app';
3+
import Head from 'next/head';
34

45
import Aside from '~/modules/layout/components/Aside';
56
import Header from '~/modules/layout/components/Header';
@@ -18,6 +19,9 @@ function MyApp({
1819
}: AppProps<PageProps>) {
1920
return (
2021
<div>
22+
<Head>
23+
<link rel='icon' href='/favicon.ico' />
24+
</Head>
2125
<Header />
2226
<section className='flex px-10'>
2327
<Aside docs={docs} />

website/pages/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ export default function Home({ docs }: Props) {
1212
<Head>
1313
<title>React Components</title>
1414
<meta name='description' content='Generated by create next app' />
15-
<link rel='icon' href='/favicon.ico' />
1615
</Head>
1716

1817
<main className='flex-grow px-10 py-5'>

0 commit comments

Comments
 (0)