Repository navigation
Expand file tree
/
Copy pathSEO.tsx
More file actions
58 lines (50 loc) · 1.23 KB
/
Copy pathSEO.tsx
File metadata and controls
58 lines (50 loc) · 1.23 KB
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
import * as React from "react";
import { DefaultSeo, NextSeo, NextSeoProps } from "next-seo";
import Head from "next/head";
import { DefaultSeoProps } from "next-seo";
export interface Props extends NextSeoProps {
title?: string;
description?: string;
image?: string;
}
const title = "Railway Docs";
export const url = "https://docs.railway.app";
const description = "Documentation for Railway";
const image = "https://docs.railway.app/og.png";
const config: DefaultSeoProps = {
title,
description,
openGraph: {
type: "website",
url,
site_name: title,
images: [{ url: image }],
},
twitter: {
handle: "@Railway",
cardType: "summary_large_image",
},
};
export const SEO: React.FC<Props> = ({ image, ...props }) => {
const title = props.title ?? config.title;
const description = props.description || config.description;
return (
<>
<DefaultSeo {...config} />
<NextSeo
{...props}
{...(image == null
? {}
: {
openGraph: {
images: [{ url: image }],
},
})}
/>
<Head>
<title>{title}</title>
<meta name="description" content={description} />
</Head>
</>
);
};