generated from shuding/nextra-docs-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
theme.config.tsx
91 lines (88 loc) · 2.8 KB
/
theme.config.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import React from "react";
import { DocsThemeConfig, useConfig } from "nextra-theme-docs";
import { useRouter } from "next/router";
import Image from "./pages/api/og-image";
const config: DocsThemeConfig = {
logo: <b>Reading React</b>,
project: {
link: "https://github.com/zmzlois/reading-react",
},
chat: {
link: "https://discord.gg/CPWTVStGZQ",
},
docsRepositoryBase: "https://github.com/zmzlois/reading-react",
footer: {
text: (
<div>
Reading React - zmzlois <br />{" "}
<p className="text-xs">
Translated from{" "}
<a href="https://react-book-new.vercel.app/">
Analysing React Source Code
</a>
</p>
</div>
),
},
head: () => {
const { asPath, defaultLocale, locale } = useRouter();
const { frontMatter } = useConfig();
const url =
"https://reading-react.vercel.app" +
(defaultLocale === locale ? asPath : `/${locale}${asPath}`);
// const image = Image({ title: frontMatter.title || "Reading React" }).then(
// (res) => res.url
// );
return (
<>
<meta property="og:url" content={url} />
<meta name="twitter:site" content="@zmzlois"></meta>
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:creator" content="@zmzlois"></meta>
<meta
name="twitter:title"
content={frontMatter.title || "Reading React"}
></meta>
<meta
name="twitter:description"
content={frontMatter.title || "Reading React"}
></meta>
<meta
name="twitter:image"
content={`${
process.env.VERCEL_URL ? "https://" + process.env.VERCEL_URL : ""
}/api/og-image`}
></meta>
<meta
name="twitter:image"
content={`https://repository-images.githubusercontent.com/720122724/9a5671a9-c923-4dd6-ad4d-0cc62550809f`}
></meta>
<meta property="og:image" content="Link preview image URL"></meta>
<meta
property="og:title"
content={frontMatter.title || "Reading React"}
/>
<meta
property="og:description"
content={frontMatter.title || "Reading React"}
/>
<meta
property="og:image"
content={`${
process.env.VERCEL_URL ? "https://" + process.env.VERCEL_URL : ""
}/api/og-image`}
/>
<meta
property="og:image"
content={`https://repository-images.githubusercontent.com/720122724/9a5671a9-c923-4dd6-ad4d-0cc62550809f`}
/>
<meta
property="og:title"
content={frontMatter.title || "Reading React"}
></meta>
<meta name="apple-mobile-web-app-title" content="Reading React"></meta>
</>
);
},
};
export default config;