-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy paththeme.config.tsx
More file actions
159 lines (146 loc) · 4.13 KB
/
theme.config.tsx
File metadata and controls
159 lines (146 loc) · 4.13 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
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
import type { DocsThemeConfig } from "nextra-theme-docs";
import { useConfig } from "nextra-theme-docs";
import { useRouter } from "next/router";
import dynamic from "next/dynamic";
import FooterMenu from "components/FooterMenu";
import { DesktopGuard } from "components/DesktopGuard";
import { MobileGuard } from "components/MobileGuard";
import AnkrLogo from "./public/logo/ankr-docs-with-logo.svg";
import NextraFooter from "./public/logo/nextra-footer.svg";
const Web3APIButton = dynamic(
() =>
import("components/Web3APIButton").then((module) => module.Web3APIButton),
{ ssr: false }
);
const titleTemplate = "%s — Ankr";
const host = "https://www.ankr.com/docs";
const config: DocsThemeConfig = {
project: {
link: "https://github.com/Ankr-network/",
},
docsRepositoryBase: "https://github.com/Ankr-network/ankr-docs/blob/main",
useNextSeoProps() {
const { pathname } = useRouter();
const config = useConfig();
const description = config.frontMatter.description
? config.frontMatter.description
: "Ankr is the leading Web3 infrastructure company.";
const image = config.frontMatter.image || `${host}/og/image.png`;
return {
canonical: `${host}${pathname}${pathname.endsWith("/") ? "" : "/"}`,
description,
openGraph: {
type: "website",
images: [{ url: image }],
},
themeColor: "#ffffff",
titleTemplate,
twitter: {
cardType: "summary_large_image",
site: "ankr.com",
},
};
},
logo: <AnkrLogo />,
head() {
const config = useConfig();
const image = config.frontMatter.image || `${host}/og/image.png`;
return (
<>
{/* General */}
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta httpEquiv="Content-Language" content="en" />
{/* SEO */}
<meta name="twitter:image" content={image} />
<meta
name="apple-mobile-web-app-title"
content={titleTemplate.replace("%s", config.title)}
/>
<meta name="msapplication-TileColor" content="#ffffff" />
{/* Favicons */}
<link rel="manifest" href="/docs/favicon/site.webmanifest" />
<link
rel="icon"
type="image/svg+xml"
href="/docs/favicon/favicon.ico"
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href="/docs/favicon/favicon-16x16.png"
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href="/docs/favicon/favicon-32x32.png"
/>
<link
rel="apple-icon"
sizes="180x180"
href="/docs/favicon/apple-icon-180x180.png"
/>
<link
rel="mask-icon"
href="/docs/favicon/safari-pinned-tab.svg"
color="#000000"
/>
</>
);
},
editLink: {
text: "Edit this page on GitHub →",
},
feedback: {
content: "Give us feedback →",
labels: "feedback",
},
sidebar: {
titleComponent({ title, type }) {
if (type === "separator") {
if (title === "web3APIButton") {
return (
<MobileGuard>
<Web3APIButton />
</MobileGuard>
);
}
return <span className="cursor-default">{title}</span>;
}
return <>{title}</>;
},
defaultMenuCollapseLevel: 1,
toggleButton: true,
},
footer: {
text: (
<div className="flex w-full flex-col items-center sm:items-start">
<FooterMenu />
<div>
<a
className="flex items-center gap-1 text-current"
target="_blank"
rel="noopener noreferrer"
title="nextra.site homepage"
href="https://nextra.site"
>
<span>Powered by</span>
<NextraFooter />
</a>
</div>
<p className="mt-6 text-xs">
© {new Date().getFullYear()} Ankr All rights reserved | info@ankr.com
</p>
</div>
),
},
navbar: {
extraContent: (
<DesktopGuard>
<Web3APIButton />
</DesktopGuard>
),
},
};
export default config;