-
Notifications
You must be signed in to change notification settings - Fork 75
Expand file tree
/
Copy pathdocusaurus.config.js
More file actions
429 lines (394 loc) · 13.3 KB
/
docusaurus.config.js
File metadata and controls
429 lines (394 loc) · 13.3 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
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
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
// This file is part of midnight-docs.
// SPDX-License-Identifier: Apache-2.0
// @ts-check
require("dotenv").config();
const { themes: prismThemes } = require("prism-react-renderer");
const lightCodeTheme = prismThemes.github;
const darkCodeTheme = prismThemes.dracula;
/** @type {import('@docusaurus/types').Config} */
const config = {
title: "Midnight Docs",
tagline: "Midnight DUST is cool",
favicon: "img/favicon.ico",
markdown: { mermaid: true },
themes: [
"@docusaurus/theme-mermaid",
],
url: "https://docs.midnight.network",
baseUrl: "/",
trailingSlash: false,
organizationName: "midnightntwrk",
projectName: "midnight-docs",
onBrokenLinks: "warn",
onBrokenMarkdownLinks: "warn",
plugins: [
// MAIN DOCS
[
"@docusaurus/plugin-content-docs",
{
id: "main",
path: "docs",
routeBasePath: "/",
lastVersion: "current",
versions: {
current: {
label: "v1",
},
"0.0.0": {
label: "v0 (Legacy)",
},
},
sidebarPath: require.resolve("./sidebars.main.js"),
editUrl: "https://github.com/midnightntwrk/midnight-docs/edit/main/",
showLastUpdateTime: true,
showLastUpdateAuthor: false,
async sidebarItemsGenerator({defaultSidebarItemsGenerator, ...args}) {
const sidebarItems = await defaultSidebarItemsGenerator(args);
// Filter function to process sidebar items recursively
const processItems = (items) => {
return items.map((item) => {
// If this is a category
if (item.type === 'category') {
// Check if this is the Release notes category
if (item.label === 'Release notes' && item.items) {
// Filter out all subcategories, keep only doc items
const docsOnly = item.items.filter(subItem => subItem.type === 'doc');
return { ...item, items: docsOnly };
}
// For other categories, recursively process their items
if (item.items) {
return { ...item, items: processItems(item.items) };
}
}
return item;
});
};
return processItems(sidebarItems);
},
},
],
// COMPACT DOCS
// [
// "@docusaurus/plugin-content-docs",
// {
// id: "compact",
// path: "compact",
// routeBasePath: "compact",
// sidebarPath: require.resolve("./sidebars.compact.js"),
// editUrl: "https://github.com/midnightntwrk/midnight-docs/edit/main/",
// showLastUpdateTime: true,
// showLastUpdateAuthor: false,
// },
// ],
// ACADEMY DOCS
// [
// "@docusaurus/plugin-content-docs",
// {
// id: "academy",
// path: "academy",
// routeBasePath: "academy",
// sidebarPath: require.resolve("./sidebars.academy.js"),
// editUrl: "https://github.com/midnightntwrk/midnight-docs/edit/main/",
// showLastUpdateTime: true,
// showLastUpdateAuthor: false,
// },
// ],
// API REFERENCE DOCS
[
"@docusaurus/plugin-content-docs",
{
id: "apis",
path: "api-reference",
routeBasePath: "api-reference",
sidebarPath: require.resolve("./sidebars.apis.js"),
editUrl: "https://github.com/midnightntwrk/midnight-docs/edit/main/",
showLastUpdateTime: true,
showLastUpdateAuthor: false,
},
],
// SDKs DOCS
[
"@docusaurus/plugin-content-docs",
{
id: "sdks",
path: "sdks",
routeBasePath: "sdks",
sidebarPath: require.resolve("./sidebars.sdks.js"),
editUrl: "https://github.com/midnightntwrk/midnight-docs/edit/main/",
showLastUpdateTime: true,
showLastUpdateAuthor: false,
},
],
// INDEXER SCHEMA DOCS
[
"@graphql-markdown/docusaurus",
/** @type {import('@graphql-markdown/types').ConfigOptions} */
{
schema: "./static/midnight-indexer/schema-v4.graphql",
rootPath: "api-reference", // docs will be generated under './api-reference/midnight-indexer' (rootPath/baseURL)
baseURL: "midnight-indexer",
loaders: {
GraphQLFileLoader: "@graphql-tools/graphql-file-loader", // local file schema
},
// Optional advanced settings
pretty: true,
},
],
// BLOG
[
"./plugins/blog-plugin.js",
{
id: "default",
blogTitle: "Dev Diaries",
blogDescription: "Updates, insights, and dev news from Midnight.",
showReadingTime: true,
routeBasePath: "blog",
path: "./blog",
blogListComponent: require.resolve("./src/components/BlogIndex/index.js"),
blogPostComponent: "@theme/BlogPostPage",
blogTagsListComponent: "@theme/BlogTagsListPage",
blogTagsPostsComponent: "@theme/BlogTagsPostsPage",
postsPerPage: "ALL",
blogSidebarTitle: "All posts",
blogSidebarCount: "ALL",
onInlineAuthors: "ignore",
onUntruncatedBlogPosts: "ignore",
},
],
// CLIENT REDIRECTS
[
'@docusaurus/plugin-client-redirects',
{
redirects: [
// Academy redirects (external)
{
from: [
'/academy',
'/academy/module-1',
'/academy/module-2',
'/academy/module-3',
'/academy/module-4',
'/academy/module-5',
'/academy/module-6',
'/academy/module-7',
'/academy/module-8',
],
to: 'https://academy.midnight.network/',
},
],
},
],
// LLMS TXT GENERATOR
[
'@signalwire/docusaurus-plugin-llms-txt',
{
siteTitle: 'Midnight Docs',
siteDescription: 'Comprehensive documentation for building on Midnight.',
depth: 2,
content: {
enableLlmsFullTxt: true,
includeVersionedDocs: false,
enableMarkdownFiles: true,
includeGeneratedIndex: false,
excludeRoutes: [
'_architecture/*',
'_contribute/*',
'_learn/*',
'_legal/*',
'_develop/*',
'_operate/*',
'_other/*',
'_validate/*',
'/relnotes/*/**',
'/tags/**',
'/archive/**'
],
},
includeOrder: [
'overview/*',
'what-is-midnight.mdx',
'getting-started/*',
'examples/*',
'tutorials/*',
'concepts/*',
'guides/*',
'compact/*',
'nodes/*',
'relnotes/*',
'glossary.mdx',
'troubleshoot/*',
],
}
],
require.resolve("./plugins/webpack-yaml-loader"),
],
i18n: {
defaultLocale: "en",
locales: ["en"],
},
customFields: {
posthogApiKey: process.env.POSTHOG_API_KEY,
posthogApiHost: process.env.POSTHOG_API_HOST,
posthogProjectId: process.env.POSTHOG_PROJECT_ID,
// Typesense search-only API key (safe to expose in client)
typesenseSearchApiKey: process.env.TYPESENSE_SEARCH_API_KEY,
typesenseHost: process.env.TYPESENSE_HOST,
typesenseCollectionName: process.env.TYPESENSE_COLLECTION_NAME || 'midnight-docs',
githubEditBase: 'https://github.com/midnightntwrk/midnight-docs/edit/main/',
githubRawBase: 'https://raw.githubusercontent.com/midnightntwrk/midnight-docs/main/',
},
scripts: [
{ src: "/add-theme-class.js", async: true },
{ src: "/theme-sync.js", async: true },
{ src: "/force-theme.js", async: true },
{ src: "/common-room-signal.js", async: false },
{
src: "https://cmp.osano.com/AzZXI3TYiFWNB5yus/1489a4c7-fc85-49c4-99a3-1367c5a5ba96/osano.js",
async: false,
},
{
src: "https://widget.kapa.ai/kapa-widget.bundle.js",
"data-website-id": "54f87db5-cd75-47b9-8bcc-94cd1c5cc86f",
"data-project-name": "Shielded",
"data-project-color": "#000000",
"data-project-logo":
"https://pbs.twimg.com/profile_images/1707073625214582784/MsMpvtzV_200x200.jpg",
"data-modal-z-index": "10000",
"data-button-position-bottom": "120px",
"data-button-position-right": "10px",
"data-modal-override-open-id": "custom-ask-ai-button",
"data-modal-title": "Need help with Midnight? Ask me anything!",
async: true,
},
],
presets: [
[
"classic",
{
sitemap: {
changefreq: "weekly",
lastmod: 'date', // date of last modification of the page
priority: 0.5,
filename: "sitemap.xml",
ignorePatterns: ['/tags/**', '/archive/**', '/0.0.0/**', '/next/**'],
},
gtag: process.env.GOOGLE_TAG_MANAGER_ID
? { trackingID: process.env.GOOGLE_TAG_MANAGER_ID }
: undefined,
docs: false, // we use standalone docs plugins
blog: false,
theme: {
customCss: [
require.resolve("./src/css/custom.css"),
require.resolve("./src/css/osano.css"),
],
},
},
],
],
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
themeConfig: {
image: "img/og-image.png",
metadata: [
{ name: "algolia-site-verification", content: "71D46C846F83C714" },
],
algolia: {
appId: process.env.ALGOLIA_APP_ID || 'Q7T3VYHX3K',
apiKey: process.env.ALGOLIA_SEARCH_KEY,
indexName: "Midnight Docs",
contextualSearch: true,
searchPagePath: "search",
searchParameters: {},
},
navbar: {
logo: {
alt: "Midnight Logo",
src: "img/midnight-header-logo-light.svg",
srcDark: "img/midnight-header-logo-dark.svg",
href: "/",
},
items: [
{ to: "/api-reference", label: "API reference", position: "left", activeBaseRegex: "^/api-reference(/|$)" },
{ to: "/sdks", label: "SDKs", position: "left", activeBaseRegex: "^/sdks(/|$)" },
{ to: "/compact", label: "Compact", position: "left", activeBaseRegex: "^/compact(/|$)" },
{ to: "/blog", label: "Dev Diaries", position: "left", activeBaseRegex: "^/blog(/|$)" },
// {
// type: 'docsVersionDropdown',
// position: "right",
// docsPluginId: 'main',
// },
{
type: "html",
position: "right",
value:
'<button id="custom-ask-ai-button" class="button button--primary">AI search</button>',
},
],
},
footer: {
logo: {
alt: "Midnight Logo",
src: "img/midnight-header-logo-dark.svg",
width: 235,
height: 50,
},
links: [
{
title: "Resources",
items: [
{ label: "Midnight Foundation", href: "https://midnight.network/" },
{ label: "Dev Diaries", href: "/blog" },
{ label: "Glacier Drop", href: "https://www.midnight.gd/" },
{ label: "Careers", href: "https://midnight.network/careers" },
],
},
{
title: "Legal",
items: [
{
label: "Cookie Policy",
href:
"https://45047878.fs1.hubspotusercontent-na1.net/hubfs/45047878/Midnight%20Foundation%20cookie-policy.pdf",
},
{
label: "Privacy Policy",
href:
"https://45047878.fs1.hubspotusercontent-na1.net/hubfs/45047878/Midnight%20Foundation%20%20-%20Privacy%20Notice.pdf",
},
{
label: "Terms and Conditions",
href:
"https://45047878.fs1.hubspotusercontent-na1.net/hubfs/45047878/Midnight%20Foundation%20-%20Website%20Terms%20of%20Use.pdf",
},
],
},
{
title: "Social",
items: [
{
html: `<a href="https://www.youtube.com/channel/UCy3oZ64F3FOtjZ5sZGQNgkA" target="_blank" rel="noopener noreferrer" aria-label="YouTube"><img src="/img/youtube.svg" alt="YouTube" /></a>`,
},
{
html: `<a href="https://x.com/MidnightNtwrk" target="_blank" rel="noopener noreferrer" aria-label="X/Twitter"><img src="/img/x.svg" alt="X/Twitter" /></a>`,
},
{
html: `<a href="https://discord.com/invite/midnightnetwork" target="_blank" rel="noopener noreferrer" aria-label="Discord"><img src="/img/discord.svg" alt="Discord" /></a>`,
},
{
html: `<a href="https://www.linkedin.com/showcase/midnight-ntwrk/" target="_blank" rel="noopener noreferrer" aria-label="LinkedIn"><img src="/img/linkedin.svg" alt="LinkedIn" /></a>`,
},
],
},
],
copyright: `© ${new Date().getFullYear()} Input Output Global, Inc. All Rights Reserved.`,
},
colorMode: { defaultMode: "dark" },
docs: { sidebar: { hideable: true } },
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
additionalLanguages: ["bash", "nix", "json", "json5", "yaml"],
},
},
};
module.exports = config;