-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy paththeme.config.tsx
135 lines (128 loc) · 4.37 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
import NavbarHeader from "@/components/NavbarHeader";
import Navigation from "@/components/Navigation";
import Footer from "@/components/Footer";
import { useRouter } from "next/router";
import { type DocsThemeConfig, useConfig } from "nextra-theme-docs";
import { SymposiaCard } from "@/components/SymposiaCard";
import { ArticleWrapper } from "@/components/ArticleWrapper";
const SITE_ROOT = process.env.NEXT_PUBLIC_SITE_ROOT;
const config: DocsThemeConfig = {
docsRepositoryBase: "https://github.com/systemphil/sphil/tree/dev", // root for every edit link
editLink: {
text: "Edit this page on GitHub",
},
footer: {
component: Footer,
},
head: function Head() {
const router = useRouter();
const { frontMatter } = useConfig();
const systemTheme = "light";
const fullUrl =
router.asPath === "/" ? SITE_ROOT : `${SITE_ROOT}${router.asPath}`;
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="#FFFFFF"
/>
<link
rel="shortcut icon"
href={`/images/favicon-${systemTheme}/favicon.ico`}
/>
<meta name="msapplication-TileColor" content="#FFFFFF" />
<meta name="theme-color" content="#FFF" />
<meta property="og:type" content="website" />
<meta property="og:url" content={fullUrl} />
<link rel="canonical" href={fullUrl} />
<meta
name="image"
property="og:image"
content={`${SITE_ROOT}/og-image.png`}
/>
<meta property="og:locale" content="en_IE" />
<meta property="og:site_name" content="sPhil" />
<meta
name="description"
property="og:description"
content={
frontMatter.description ||
"Where Philosophy Meets Open Collaboration"
}
/>
<meta
name="title"
property="og:title"
content={
frontMatter.overrideTitle ||
frontMatter.title ||
"sPhil"
}
/>
</>
);
},
logo: NavbarHeader,
logoLink: false,
main: ArticleWrapper,
navbar: {
component: Navigation,
},
primaryHue: {
dark: 155,
light: 215,
},
project: {
link: "https://github.com/systemphil/sphil", // linked icon in the navbar top-right
},
search: {
placeholder: "Search encyclopaedia…",
},
toc: {
backToTop: true,
extraContent: <SymposiaCard />,
},
useNextSeoProps: function SEO() {
const router = useRouter();
const { frontMatter } = useConfig();
let section = "sPhil";
if (router?.pathname.startsWith("/hegel")) {
section = "Hegel";
}
if (router?.pathname.startsWith("/kant")) {
section = "Kant";
}
if (router?.pathname.startsWith("/spinoza")) {
section = "Spinoza";
}
const defaultTitle = frontMatter.overrideTitle || section;
return {
description: frontMatter.description,
defaultTitle,
titleTemplate: `%s – ${section}`,
};
},
};
export default config;