-
Notifications
You must be signed in to change notification settings - Fork 0
/
theme.config.tsx
176 lines (163 loc) · 5.22 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
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
import { useState, useEffect } from "react";
import { useRouter } from "next/router";
import { useConfig, useTheme, type DocsThemeConfig } from "nextra-theme-docs";
import { Footer } from "./components/Footer";
import Navigation from "./components/Navigation";
import HeaderLogo from "./components/HeaderLogo";
import ExtraContent from "./components/ExtraContent";
import {Discord, Github, Telegram, X} from "./components/Social";
const SITE_ROOT = "https://turbo.build";
const config: DocsThemeConfig = {
sidebar: {
defaultMenuCollapseLevel: 10000,
// toggleButton: true,
},
docsRepositoryBase: "https://github.com/0xobelisk/obelisk-website/blob/main",
useNextSeoProps: function SEO() {
const router = useRouter();
const { frontMatter } = useConfig();
let section = "Obelisk | Let's build technologies for mass adoption together";
if (router?.pathname.startsWith("/engine")) {
section = "docs";
}
if (router?.pathname.startsWith("/repo")) {
section = "docs";
}
const defaultTitle = frontMatter.overrideTitle || section;
return {
description: frontMatter.description,
defaultTitle,
titleTemplate: `%s – ${section}`,
};
},
gitTimestamp({ timestamp }) {
// eslint-disable-next-line react-hooks/rules-of-hooks
const [dateString, setDateString] = useState(timestamp.toISOString());
// eslint-disable-next-line react-hooks/rules-of-hooks
useEffect(() => {
try {
setDateString(
timestamp.toLocaleDateString(navigator.language, {
day: "numeric",
month: "long",
year: "numeric",
})
);
} catch (e) {
// Ignore errors here; they get the ISO string.
// At least one person out there has manually misconfigured navigator.language.
}
}, [timestamp]);
return <>Last updated on {dateString}</>;
},
toc: {
float: true,
// backToTop: true,
extraContent: ExtraContent,
},
// font: false,
logo: HeaderLogo,
logoLink: false,
head: function Head() {
const router = useRouter();
const { systemTheme = "dark" } = useTheme();
const { frontMatter } = useConfig();
const fullUrl =
router.asPath === "/" ? SITE_ROOT : `${SITE_ROOT}${router.asPath}`;
const asPath = router.asPath;
let ogUrl;
if (asPath === "/") {
ogUrl = `${SITE_ROOT}/api/og`;
} else if (frontMatter?.ogImage) {
ogUrl = `${SITE_ROOT}${frontMatter.ogImage}`;
} else {
const type = asPath.startsWith("/repo")
? "repo"
: asPath.startsWith("/engine")
? "engine"
: "";
const title = frontMatter.title
? `&title=${encodeURIComponent(frontMatter.title)}`
: "";
ogUrl = `${SITE_ROOT}/api/og?type=${type}${title}`;
}
return (
<>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link
rel="apple-touch-icon"
sizes="180x180"
href={`/images/favicon-${systemTheme}/apple-touch-icon.png`}
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href={`/images/favicon-${systemTheme}/favicon-32x32.png`}
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href={`/images/favicon-${systemTheme}/favicon-16x16.png`}
/>
<link
rel="mask-icon"
href={`/images/favicon-${systemTheme}/safari-pinned-tab.svg`}
color="#000000"
/>
<link
rel="shortcut icon"
href={`/images/favicon-${systemTheme}/favicon.ico`}
/>
{/*<meta name="msapplication-TileColor" content="#000000" />*/}
{/*<meta name="theme-color" content="#000" />*/}
{/*<meta name="twitter:card" content="summary_large_image" />*/}
{/*<meta name="twitter:site" content="@turborepo" />*/}
{/*<meta name="twitter:creator" content="@turborepo" />*/}
{/*<meta property="og:type" content="website" />*/}
{/*<meta property="og:url" content={fullUrl} />*/}
{/*<link rel="canonical" href={fullUrl} />*/}
{/*<meta property="twitter:image" content={ogUrl} />*/}
{/*<meta property="og:image" content={ogUrl} />*/}
{/*<meta property="og:locale" content="en_IE" />*/}
{/*<meta property="og:site_name" content="Obelist" />*/}
{/*<link rel="prefetch" href="/repo" as="document" />*/}
{/*<link rel="prefetch" href="/repo/docs" as="document" />*/}
{/*<link rel="prefetch" href="/engine" as="document" />*/}
{/*<link rel="prefetch" href="/engine/docs" as="document" />*/}
{/*<link*/}
{/* rel="alternate"*/}
{/* type="application/rss+xml"*/}
{/* title="Obelisk Blog"*/}
{/* href="https://turbo.build/feed.xml"*/}
{/*/>*/}
</>
);
},
i18n: [],
editLink: {
text: "Edit this page on GitHub",
},
navbar: {
component: Navigation,
extraContent: (
<>
<Github />
<Discord />
<X />
<Telegram/>
</>
),
},
search: {
placeholder: "Search documentation…",
},
footer: {
component: Footer,
},
nextThemes: {
defaultTheme: "dark",
},
};
export default config;