-
Notifications
You must be signed in to change notification settings - Fork 51
/
docusaurus.config.js
331 lines (312 loc) · 8.6 KB
/
docusaurus.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
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion
const lightCodeTheme = require("prism-react-renderer/themes/github");
const darkCodeTheme = require("prism-react-renderer/themes/dracula");
const EDIT_URL = "https://github.com/packit/packit.dev/tree/main";
// Represents one section of documentation, e.g. deployment or source-git
// Since the config is JS, we can abuse it to avoid unnecessary duplication.
class Section {
// Args:
// path: Relative path to the directory containing the documentation
// label: Label shown on the navigation bar of the webpage
// editUrl: Base of the URL that is generated at the end of any page of the
// given documentation. This URL is different for the deployment or
// research docs.
constructor(path, label, editUrl, nested) {
this.path = path;
this.label = label;
this.editUrl = editUrl || EDIT_URL;
this.nested = nested;
}
// Generates a Docusaurus plugin entry.
docs() {
return [
"@docusaurus/plugin-content-docs",
{
id: this.path,
path: this.path,
routeBasePath: this.path,
sidebarPath: require.resolve("./sidebars.js"),
editUrl: this.editUrl,
},
];
}
// Generates an item for the navigation bar.
navbar() {
if (this.nested) {
return {
type: "dropdown",
label: this.label,
to: this.path,
items: this.nested.map((section) => section.navbar()),
};
}
return {
type: "doc",
docId: "index",
docsPluginId: this.path,
label: this.label,
};
}
}
const developmentSections = [
new Section(
"deployment",
"Deployment",
"https://github.com/packit/deployment/tree/main/docs",
),
new Section(
"research",
"Research",
"https://github.com/packit/research/tree/main",
),
new Section(
"agile",
"Agile",
"https://github.com/packit/agile/tree/main/docs",
),
new Section(
"specfile",
"specfile library",
"https://github.com/packit/specfile/tree/main/docs",
),
];
const sections = [
new Section("docs", "Documentation"),
new Section("source-git", "Source-git"),
new Section("development", "Development", undefined, developmentSections),
];
/** @type {import('@docusaurus/types').Config} */
const config = {
title: "Packit",
tagline: "Automate and ease the work of maintainers and developers",
favicon: "img/favicon.png",
url: "https://packit.dev",
baseUrl: "/",
// GitHub Pages deployment config.
organizationName: "packit", // Usually your GitHub org/user name.
projectName: "packit.dev", // Usually your repo name.
trailingSlash: false,
onBrokenLinks: "throw",
onBrokenMarkdownLinks: "throw",
i18n: {
defaultLocale: "en",
locales: ["en"],
},
presets: [
[
"classic",
/** @type {import('@docusaurus/preset-classic').Options} */
({
// We have multiple instances of documentation and blogs, so disable the
// defaults and set them up from plugins below.
docs: false,
blog: false,
theme: {
customCss: require.resolve("./src/css/custom.css"),
},
}),
],
],
plugins: [
...sections.map((section) => section.docs()),
...developmentSections.map((section) => section.docs()),
[
"@docusaurus/plugin-content-blog",
{
id: "posts",
routeBasePath: "posts",
path: "posts",
authorsMapPath: "../authors.yml",
feedOptions: {
type: "all",
title: "Packit Blog",
description: "Blog posts by Packit",
},
editUrl: EDIT_URL,
},
],
[
"@docusaurus/plugin-content-blog",
{
id: "weekly",
routeBasePath: "posts/weekly",
path: "weekly",
authorsMapPath: "../authors.yml",
feedOptions: {
type: "all",
title: "Packit Weekly",
description: "Weekly updates by Packit",
},
blogSidebarCount: 12,
editUrl: EDIT_URL,
},
],
[
"@docusaurus/plugin-client-redirects",
{
redirects: [
{ from: ["/about"], to: "/docs/about" },
{ from: ["/faq"], to: "/docs/faq" },
{
from: ["/testing-farm", "/docs/testing-farm"],
to: "/docs/configuration/upstream/tests",
},
{
from: [
"/packit-service",
"/packit-as-a-service",
"/docs/packit-service",
"/docs/packit-as-a-service",
],
to: "/docs/guide",
},
{
from: [
"/posts/weekly/january-2022",
"/posts/weekly/february-2022",
"/posts/weekly/march-2022",
"/posts/weekly/april-2022",
"/posts/weekly/may-2022",
"/posts/weekly/june-2022",
"/posts/weekly/july-2022",
"/posts/weekly/august-2022",
"/posts/weekly/september-2022",
"/posts/weekly/october-2022",
"/posts/weekly/november-2022",
"/posts/weekly/december-2022",
],
to: "/posts/weekly/2022",
},
{
from: ["/posts/weekly/2023/08/07"],
to: "/posts/weekly/2023/week-31",
},
{
from: ["/posts/weekly/2023/08/14"],
to: "/posts/weekly/2023/week-32",
},
],
},
],
],
markdown: {
mermaid: true,
},
themes: ["@docusaurus/theme-mermaid"],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
docs: {
sidebar: {
hideable: true,
},
},
// Replace with your project's social card
image: "img/docusaurus-social-card.jpg", // TODO
navbar: {
title: "Packit",
logo: {
alt: "Packit Logo",
src: "img/logo.png",
},
items: [
...sections.map((section) => section.navbar()),
{
type: "dropdown",
label: "Blog Posts",
to: "/posts",
items: [{ to: "/posts/weekly", label: "Weekly Updates" }],
},
{
href: "https://dashboard.packit.dev",
label: "Dashboard",
position: "right",
},
{
href: "https://status.packit.dev/",
label: "Status",
position: "right",
},
{
href: "https://github.com/packit",
// label: "GitHub",
position: "right",
className: "header-github-link",
},
],
},
footer: {
style: "light",
links: [
{
title: "Docs",
items: [
{
label: "Onboarding guide",
to: "/docs/guide",
},
{
label: "Fedora releases guide",
to: "/docs/fedora-releases-guide",
},
],
},
{
title: "Contact",
items: [
{
html: `
<a href="https://matrix.to/#/#packit:fedora.im?web-instance[element.io]=chat.fedoraproject.org">
#packit:fedora.im
</a> (Matrix)
`,
},
{
html: `
<a href="mailto:[email protected]">[email protected]</a>
`,
},
{
html: `
<a href="https://fosstodon.org/@packit" rel="me">
</a> (Mastodon)
`,
},
],
},
{
title: "More",
items: [
{
label: "Usage Charts",
to: "/usage",
},
{
label: "Blog Posts",
to: "/posts",
},
{
label: "GitHub",
href: "https://github.com/packit",
},
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} Packit is a Red Hat sponsored free software project. Built with Docusaurus.`,
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
},
algolia: {
// The application ID provided by Algolia
appId: "STHKG8EYKZ",
// Public API key: it is safe to commit it
apiKey: "5ea910a1c2fb83cb1cc4978e14d7d570",
indexName: "packitdev",
},
}),
};
module.exports = config;