forked from fastify/website
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocusaurus.config.js
More file actions
299 lines (273 loc) · 9.72 KB
/
docusaurus.config.js
File metadata and controls
299 lines (273 loc) · 9.72 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
// @ts-check
const { themes } = require('prism-react-renderer')
const lightCodeTheme = themes.github
const darkCodeTheme = themes.dracula
const u = require('./docusaurus.config.utils')
const versions = require('./versions.json')
const BASE_URL = process.env.BASE_URL ?? '/'
const isDev = process.env.NODE_ENV === 'development'
const latestMajorVersion = versions.find((v) => v.startsWith('v'))?.split('.')[0] || 'v5'
u.checkGeneratedData()
/** @type {import('@docusaurus/types').Config} */
const config = {
title: 'Fastify',
tagline: 'Fast and low overhead web framework, for Node.js',
url: 'https://fastify.io',
baseUrl: BASE_URL,
onBrokenLinks: 'warn',
favicon: 'img/favicon.ico',
// GitHub Pages redirects with a trailing slash, so this configures links to match
trailingSlash: true,
// GitHub pages deployment config.
organizationName: 'fastify',
projectName: 'website',
i18n: {
defaultLocale: 'en',
locales: ['en'],
},
markdown: {
hooks: {
onBrokenMarkdownLinks: 'warn',
},
},
// https://docusaurus.io/docs/using-plugins#using-presets
presets: [
[
'classic',
/** @type {import('@docusaurus/preset-classic').Options} */
({
debug: true, // force debug plugin usage
// https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-docs#configuration
docs: {
lastVersion: 'latest', // the last version is always "latest"
editUrl: (editPage) => {
// Users can not submit doc updates to the legacy versions!
if (editPage.version !== 'latest' && !editPage.version.startsWith(latestMajorVersion)) {
return undefined
}
// We want users to submit doc updates to the upstream/next version!
return `https://github.com/fastify/fastify/edit/main/docs/${editPage.docPath}`
},
editCurrentVersion: false,
sidebarPath: 'sidebar.js',
showLastUpdateTime: true,
breadcrumbs: true,
includeCurrentVersion: isDev,
versions: u.getVersionLabels(versions),
onlyIncludeVersions: u.getVersionsIncluded({ versions, fastBuild: isDev }),
sidebarItemsGenerator: require('./sidebar.js'),
},
// https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-blog#configuration
blog: false,
// https://docusaurus.io/docs/api/themes/@docusaurus/theme-classic
theme: {
customCss: [
require.resolve('./src/css/custom.css'), //
require.resolve('./src/css/ecosystem.css'), //
],
},
// https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-pages#configuration
pages: {},
// https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-sitemap#configuration
sitemap: {
ignorePatterns: ['/scripts/**'],
},
}),
],
],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
// https://docusaurus.io/docs/api/themes/configuration
image: 'img/logos/fastify-black.svg',
colorMode: {
respectPrefersColorScheme: true,
},
docs: {
sidebar: {
autoCollapseCategories: true,
},
},
navbar: {
title: 'Home',
logo: {
alt: 'Fastify Cheetah Logo',
src: 'img/logos/fastify-black.svg',
srcDark: 'img/logos/fastify-white.svg',
},
items: [
// {
// type: 'docSidebar',
// sidebarId: 'docsSidebar',
// position: 'left',
// label: 'Docs',
// },
{
type: 'doc',
docId: 'index',
position: 'left',
label: 'Docs',
},
{ to: '/ecosystem', label: 'Ecosystem', position: 'left' },
{ to: '/benchmarks', label: 'Benchmarks', position: 'left' },
{ to: '/organizations', label: 'Adopters', position: 'left' },
{ to: '/contribute', label: 'Contribute', position: 'left' },
{ to: '/resources', label: 'Resources', position: 'left' },
{ to: '/docs/latest/Reference/LTS', label: 'Support', position: 'left' },
{
type: 'docsVersionDropdown',
position: 'right',
},
// {
// type: 'localeDropdown',
// position: 'right',
// },
{
href: 'https://github.com/fastify/fastify',
position: 'right',
className: 'header-github-link',
'aria-label': 'GitHub repository',
},
],
},
footer: {
style: 'dark',
links: [
{
title: 'Docs',
items: [
{
label: 'Getting Started',
to: '/docs/latest/Guides/Getting-Started',
},
],
},
{
title: 'Community',
items: [
{
label: 'Stack Overflow',
href: 'https://stackoverflow.com/questions/tagged/fastify',
},
{
label: 'Discord',
href: 'https://discord.gg/fastify',
},
{
label: 'X',
href: 'https://x.com/fastifyjs',
},
],
},
{
title: 'More',
items: [
// {
// label: 'Blog',
// to: '/blog',
// },
{
label: 'GitHub',
href: 'https://github.com/fastify/website',
},
],
},
],
copyright: `Fastify, Copyright © 2016-${new Date().getFullYear()} <a href="https://openjsf.org">OpenJS Foundation</a> and The Fastify team, Licensed under <a href="https://github.com/fastify/fastify/blob/main/LICENSE">MIT</a>`,
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
magicComments: [
{
className: 'theme-code-block-highlighted-line',
line: 'highlight-next-line',
block: { start: 'highlight-start', end: 'highlight-end' },
},
{
className: 'code-block-error-line',
line: 'This will error',
},
],
},
metadata: [
// Open Graph / Facebook
{ property: 'og:type', content: 'website' },
{ property: 'og:url', content: 'https://fastify.dev/' },
{ property: 'og:title', content: 'Fastify - Fast and Low Overhead Web Framework' },
{ property: 'og:description', content: 'Fastify is a fast and low overhead web framework for Node.js.' },
{ property: 'og:image', content: 'https://fastify.dev/img/logos/fastify-black.svg' },
{ property: 'og:image:width', content: '1200' },
{ property: 'og:image:height', content: '630' },
{ property: 'og:image:alt', content: 'Fastify Logo' },
{ property: 'og:site_name', content: 'Fastify' },
{ property: 'og:locale', content: 'en_US' },
// Twitter
{ name: 'twitter:card', content: 'summary_large_image' },
{ name: 'twitter:url', content: 'https://fastify.dev/' },
{ name: 'twitter:title', content: 'Fastify - Fast and Low Overhead Web Framework' },
{ name: 'twitter:description', content: 'Fastify is a fast and low overhead web framework for Node.js.' },
{ name: 'twitter:image', content: 'https://fastify.dev/img/logos/fastify-black.svg' },
// Telegram (non-standard but harmless)
{ property: 'telegram:title', content: 'Fastify - Fast and Low Overhead Web Framework' },
{ property: 'telegram:description', content: 'Fastify is a fast and low overhead web framework for Node.js.' },
{ property: 'telegram:image', content: 'https://fastify.dev/img/logos/fastify-black.svg' },
],
}),
plugins: [
'@orama/plugin-docusaurus-v3',
[
// This plugin does not work in dev mode
'@docusaurus/plugin-client-redirects',
{
redirects: [
{
from: '/organisations',
to: '/organizations',
},
],
// @ts-expect-error provided types doesn't match the real possible configuration
createRedirects(existingPath) {
// Legacy/Retro compatibility:
// Redirect for old /docs/master/ URLs
if (existingPath.startsWith('/docs/latest')) {
return existingPath.replace('/docs/latest', '/docs/master')
}
// Redirect for old /docs/v3.<x>.<y>/ URLs to the latest v3 version
if (existingPath.startsWith('/docs/v3')) {
// @ts-expect-error provided types doesn't match the real possible configuration
return u.manageRedirects({
existingPath,
major: '3',
versions,
versionsShipped: require('./versions-shipped.json'),
ignore: ['/docs/v3.29.x/Reference/', '/docs/v3.29.x/Guides/'],
})
}
// Redirect for old /docs/v2.<x>.<y>/ URLs to the latest v2 version
if (existingPath.startsWith('/docs/v2')) {
// @ts-expect-error provided types doesn't match the real possible configuration
return u.manageRedirects({
existingPath,
major: '2',
versions,
versionsShipped: require('./versions-shipped.json'),
})
}
return undefined
},
},
],
[
'@signalwire/docusaurus-plugin-llms-txt',
{
content: {
includePages: true,
enableLlmsFullTxt: true,
excludeRoutes: ['/__docusaurus/**'],
},
},
],
],
}
module.exports = config