Skip to content

Commit bdce6c9

Browse files
committed
feat: add og meta
1 parent 9eb2373 commit bdce6c9

File tree

5 files changed

+39
-4
lines changed

5 files changed

+39
-4
lines changed

src/client/components/@shared/html/index.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ export const Html: FC<Props> = ({ nonce, children }) => {
1414
<meta charSet='utf-8' />
1515
<meta name='viewport' content='width=device-width, initial-scale=1' />
1616
{IS_PROD && <link nonce={nonce} rel='manifest' href={basePath('manifest.json')} />}
17-
<title>SSR app</title>
1817
</head>
1918

2019
<body>{children}</body>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import type { FC, ReactNode } from 'react'
2+
3+
interface Props {
4+
title: string
5+
url?: string
6+
image?: string
7+
description?: string
8+
children: ReactNode
9+
}
10+
export const Page: FC<Props> = ({ children, url, image, title, description }) => (
11+
<>
12+
<title>{title}</title>
13+
<meta property='og:title' content={title} />
14+
{description && <meta property='og:description' content={description} />}
15+
{url && <meta property='og:url' content={url} />}
16+
{image && <meta property='og:image' content={image} />}
17+
18+
{children}
19+
</>
20+
)

src/client/pages/about/index.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import { About } from 'components/about'
2+
import { Page } from '@shared/page'
23

34
export default () => {
4-
return <About />
5+
return (
6+
<Page title='SSR: About'>
7+
<About />
8+
</Page>
9+
)
510
}

src/client/pages/home/index.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import { Home } from 'components/home'
2+
import { Page } from '@shared/page'
23

34
export default () => {
4-
return <Home />
5+
return (
6+
<Page title='SSR: Home'>
7+
<Home />
8+
</Page>
9+
)
510
}

src/client/pages/not-found/index.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
import { Page } from '@shared/page'
2+
13
export default () => {
2-
return <p>Not found</p>
4+
return (
5+
<Page title='SSR: Not found'>
6+
<p>Not found</p>
7+
</Page>
8+
)
39
}

0 commit comments

Comments
 (0)