-
Notifications
You must be signed in to change notification settings - Fork 2
/
Layout.tsx
63 lines (59 loc) · 1.75 KB
/
Layout.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import Head from 'next/head';
import React from 'react';
import { robots, themeColor, twitter } from '../const/siteConfig';
import { globalText } from '../localization/global';
const extractTitle = (title: string): string =>
title === ''
? globalText('title')
: title.endsWith(' ')
? `${title}- ${globalText('title')}`
: title;
function Layout({
title = '',
children,
privatePage = false,
props,
useDefaultDescription = true,
}: {
readonly title: string | undefined;
readonly useDefaultDescription?: boolean;
readonly children: JSX.Element;
readonly privatePage?: boolean;
readonly props?: JSX.Element;
}): JSX.Element {
return (
<>
<Head>
<title>{extractTitle(title)}</title>
<meta property="og:title" content={extractTitle(title)} />
<link rel="icon" href="/favicon.ico" />
<meta
name="robots"
content={privatePage ? 'noindex,nofollow' : robots}
/>
{useDefaultDescription && (
<>
<meta name="description" content={globalText('siteDescription')} />
<meta
property="og:description"
content={globalText('siteDescription')}
/>
</>
)}
<meta name="keywords" content={globalText('keywords')} />
<meta name="twitter:site" content={twitter} />
<meta name="twitter:card" content="summary_large_image" />
<link
rel="mask-icon"
href="/icons/safari-pinned-tab.svg"
color={themeColor}
/>
<meta name="msapplication-TileColor" content={themeColor} />
<meta name="theme-color" content={themeColor} />
{props}
</Head>
<div id="root">{children}</div>
</>
);
}
export default Layout;