forked from Tazhys/ntts-site
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththeme.config.js
140 lines (133 loc) · 3.86 KB
/
theme.config.js
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
import { useRouter } from "next/router";
import { useConfig } from "nextra-theme-docs";
import Logo from "./components/logo";
import Ntts from "./components/ntts";
import useLocalesMap from "./components/use-locales-map";
import {
editTextMap,
feedbackLinkMap,
footerTextMap,
gitTimestampMap,
headDescriptionMap,
languageMap,
searchPlaceholderMap,
tableOfContentsTitleMap,
titleMap,
} from "./translations/text";
/** @type {import('nextra-theme-docs').DocsThemeConfig} */
const themeConfig = {
project: {
link: "https://github.com/NoTextToSpeech/ntts-site",
},
docsRepositoryBase: "https://github.com/NoTextToSpeech/ntts-site/blob/main",
useNextSeoProps() {
return {
titleTemplate: "%s – NTTS",
};
},
primaryHue: 224,
primarySaturation: 86,
toc: {
float: true,
backToTop: true,
title: () => useLocalesMap(tableOfContentsTitleMap),
},
search: {
placeholder: () => useLocalesMap(searchPlaceholderMap),
},
editLink: {
text: () => useLocalesMap(editTextMap),
},
feedback: {
content: () => useLocalesMap(feedbackLinkMap),
},
navigation: false,
sidebar: {
defaultMenuCollapseLevel: 1,
},
logo: () => {
const title = useLocalesMap(titleMap);
return (
<>
<Logo height={30} />
</>
);
},
head: (meta) => {
const { route, locales, locale } = useRouter();
const { frontMatter, title } = useConfig();
const titleSuffix = useLocalesMap(titleMap);
const description = useLocalesMap(headDescriptionMap);
const ogImage = meta.image || `/favicon/banner.png`;
const contentLanguage = locales.join(", ");
const ogTitle = title ? `${title} – NTTS` : `NTTS: ${titleSuffix}`;
const ogDescription = frontMatter.description || description;
return (
<>
{/* Favicons, meta */}
<link
rel="apple-touch-icon"
sizes="180x180"
href="/favicon/apple-touch-icon.png"
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href="/favicon/favicon-32x32.png"
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href="/favicon/favicon-16x16.png"
/>
<link rel="icon" type="image/svg+xml" href="/favicon/favicon.svg" />
<link rel="manifest" href="/favicon/site.webmanifest" />
<link
rel="mask-icon"
href="/favicon/safari-pinned-tab.svg"
color="#000000"
/>
<meta httpEquiv="Content-Language" content={contentLanguage} />
<meta name="msapplication-TileColor" content="#ffffff" />
<meta name="apple-mobile-web-app-title" content="NTTS" />
<meta name="description" content={ogDescription} />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="@notexttospeech" />
<meta name="twitter:image" content={ogImage} />
<meta property="og:title" content={ogTitle} />
<meta property="og:description" content={ogDescription} />
<meta property="og:image" content={ogImage} />
<meta property="og:locale" content={locale} />
{locales
.filter((l) => l !== locale)
.map((l) => (
<meta property="og:locale:alternate" content={l} key={l} />
))}
</>
);
},
footer: "",
gitTimestamp({ timestamp }) {
const { locale } = useRouter();
const lastUpdatedOn = useLocalesMap(gitTimestampMap);
return (
<>
{lastUpdatedOn}{" "}
<time dateTime={timestamp.toISOString()}>
{timestamp.toLocaleDateString(locale, {
day: "numeric",
month: "long",
year: "numeric",
})}
</time>
</>
);
},
i18n: Object.entries(languageMap).map(([locale, text]) => ({
locale,
text,
})),
};
export default themeConfig;