-
Notifications
You must be signed in to change notification settings - Fork 305
/
Copy pathdocusaurus.config.js
323 lines (315 loc) · 9.61 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
import { themes } from 'prism-react-renderer';
import math from 'remark-math';
import katex from 'rehype-katex';
import chHeader from './plugins/header.js';
import fixLinks from './src/hooks/fixLinks.js';
// Helper function to skip over index.md files.
function skipIndex(items) {
return items.filter(({ type, id }) => {
return type !== 'doc' || !id.match(/index$/);
});
}
/** @type {import('@docusaurus/types').Config} */
const config = {
scripts: [{
src: "https://widget.kapa.ai/kapa-widget.bundle.js",
"data-website-id": "c0b5f156-1e92-49df-8252-adacc9feb21b",
"data-project-name": "ClickHouse",
"data-project-color": "#151515",
"data-project-logo": "https://avatars.githubusercontent.com/u/54801242?s=200&v=4",
"data-modal-disclaimer": "This is a custom LLM for ClickHouse with access to all developer documentation, open GitHub Issues, YouTube videos, and resolved StackOverflow posts. Please note that answers are generated by AI and may not be fully accurate, so please use your best judgement.",
"data-modal-example-questions": "How to speed up queries?,How to use materialized views?",
"data-kapa-branding-hide": "true",
async: true,
defer: true, // execute after document parsing, but before firing DOMContentLoaded event
}],
// Settings for Docusaurus Faster - build optimizations
future: {
experimental_faster: {
swcJsLoader: true,
swcJsMinimizer: true,
swcHtmlMinimizer: true,
lightningCssMinimizer: true,
rspackBundler: true,
mdxCrossCompilerCache: true,
},
},
title: 'ClickHouse Docs',
tagline:
'Documentation, quick starts, user guides, technical references, FAQs and more...',
url: 'https://clickhouse.com',
// url: process.env.VERCEL_URL ? `https://${process.env.VERCEL_URL}` : 'https://bookish-disco-5997zvo.pages.github.io',
baseUrl: '/docs/',
baseUrlIssueBanner: true,
onBrokenLinks: 'warn',
onBrokenMarkdownLinks: 'throw',
onDuplicateRoutes: 'throw',
// onBrokenAnchors: 'throw',
favicon: 'img/docs_favicon.ico',
organizationName: 'ClickHouse',
trailingSlash: false,
staticDirectories: ['static'],
projectName: 'clickhouse-docs',
markdown: {
mermaid: true,
},
themes: ['@docusaurus/theme-mermaid'],
presets: [
[
'classic',
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
admonitions: {
keywords: [
'note',
'tip',
'info',
'caution',
'danger',
'experimental',
'obsolete',
'warning',
'success',
'important',
'secondary'
]
},
sidebarPath: require.resolve('./sidebars.js'),
// Implements a custom sidebar to override default behaviour where index.md page shows underneath the category name.
// With this sidebar the category name is clickable to show the index.md contents.
async sidebarItemsGenerator({ defaultSidebarItemsGenerator, ...args }) {
const sidebarItems = await defaultSidebarItemsGenerator(args);
return skipIndex(sidebarItems);
},
editCurrentVersion: true,
breadcrumbs: true,
editUrl: ({ docPath }) => {
if (docPath === 'index.md') return false
if (
docPath.includes('en/development') ||
docPath.includes('en/engines') ||
docPath.includes('en/getting-started') ||
docPath.includes('en/interfaces') ||
docPath.includes('en/operations') ||
docPath.includes('en/sql-reference') ||
docPath.startsWith('ru') ||
docPath.startsWith('zh')
) {
return (
'https://github.com/ClickHouse/ClickHouse/tree/master/docs/' +
docPath
)
} else {
return (
'https://github.com/ClickHouse/clickhouse-docs/blob/main/docs/' +
docPath
)
}
},
showLastUpdateTime: false,
sidebarCollapsed: true,
routeBasePath: '/',
remarkPlugins: [math],
beforeDefaultRemarkPlugins: [fixLinks],
rehypePlugins: [katex],
},
blog: {
path: 'knowledgebase',
blogTitle: 'ClickHouse Knowledge Base',
blogDescription: 'Knowledge Base',
blogSidebarTitle: 'All KB articles',
routeBasePath: '/knowledgebase',
postsPerPage: 10,
blogSidebarCount: 'ALL',
feedOptions: {
type: 'all',
title: 'ClickHouse Knowledge Base Feed',
description:
'Feed of articles posted to the ClickHouse Knowledge Base',
copyright: `Copyright © 2016–${new Date().getFullYear()} ClickHouse, Inc. ClickHouse Docs provided under the Creative Commons CC BY-NC-SA 4.0 license. ClickHouse® is a registered trademark of ClickHouse, Inc.`,
language: 'en',
createFeedItems: async (params) => {
const { blogPosts, defaultCreateFeedItems, ...rest } = params
return defaultCreateFeedItems({
// keep only the 10 most recent blog posts in the feed
blogPosts: blogPosts.filter((item, index) => index < 10),
...rest,
})
},
},
editUrl: ({ blogPath }) => {
return (
'https://github.com/ClickHouse/clickhouse-docs/blob/main/knowledgebase/' +
blogPath
)
},
},
theme: {
customCss: [require.resolve('./src/css/custom.scss')],
},
gtag: {
trackingID: 'G-KF1LLRTQ5Q',
},
}),
],
],
// Inserts tags into the <head></head>
headTags:
[
{
// Ask AI component
tagName: 'link',
attributes: {
href: 'https://widget.kapa.ai',
rel: 'preconnect', // preemptively initiate a connection to resource
}
},
{
// Google's CDN. Caches all 'static' files in a server near to you
// to reduce load times.
tagName: 'link',
attributes: {
href: 'https://www.gstatic.com',
rel: 'preconnect',
crossorigin: 'use-credentials'
}
},
{
tagName: 'link',
attributes: {
href: 'https://www.googletagmanager.com',
rel: 'preconnect',
}
}
],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
algolia: {
appId: '5H9UG7CX5W',
apiKey: '4a7bf25cf3edbef29d78d5e1eecfdca5',
indexName: 'clickhouse',
contextualSearch: false,
searchPagePath: 'search',
},
image: 'img/docs_social_share.png',
icon: '/img/gareth.png',
docs: {
sidebar: {
autoCollapseCategories: true,
},
},
// autoCollapseSidebarCategories: true,
navbar: {
hideOnScroll: false,
logo: {
alt: 'ClickHouse',
src: 'img/ch_logo_docs.svg',
srcDark: 'img/ch_logo_docs_dark.svg',
href: 'https://clickhouse.com/',
},
items: [
],
},
footer: {
style: 'light',
links: [
{
label: 'Trademark',
to: 'https://clickhouse.com/legal/trademark-policy',
},
{
label: 'Privacy',
to: 'https://clickhouse.com/legal/privacy-policy',
},
{
label: 'Security',
to: 'https://trust.clickhouse.com/',
},
{
label: 'Terms of Service',
to: 'https://clickhouse.com/legal/agreements/terms-of-service',
},
],
copyright: `© 2016–${new Date().getFullYear()} ClickHouse, Inc.`,
},
prism: {
theme: themes.darkTheme,
darkTheme: themes.darkTheme,
additionalLanguages: ['java', 'cpp', 'rust'],
magicComments: [
// Remember to extend the default highlight class name as well!
{
className: 'theme-code-block-highlighted-line',
line: 'highlight-next-line',
block: { start: 'highlight-start', end: 'highlight-end' },
},
],
},
colorMode: {
disableSwitch: false,
respectPrefersColorScheme: true,
defaultMode: 'dark',
},
/* announcementBar: {
id: 'support_us',
content:
'Check out our new 25-minute video on <a href="https://clickhouse.com/company/events/getting-started-with-clickhouse/" target="_blank"> Getting Started with ClickHouse</a>',
backgroundColor: '#0057b7',
textColor: '#ffffff',
isCloseable: false,
},
*/
}),
plugins: [
'docusaurus-plugin-sass',
function (context, options) {
return {
name: 'docusaurus-plugin',
async postBuild({ siteConfig = {}, routesPaths = [], outDir }) {
// Print out to console all the rendered routes.
routesPaths.map((route) => {
//console.log(route)
})
},
}
},
// N.B - If you need to redirect a page please do so from vercel.json
// '@docusaurus/plugin-client-redirects',
// {
// redirects: []
// },
chHeader
],
customFields: {
blogSidebarLink: '/docs/knowledgebase', // Used for KB article page
galaxyApiEndpoint: process.env.NEXT_PUBLIC_GALAXY_API_ENDPOINT || 'http://localhost:3000',
secondaryNavItems: [
{
type: 'dropdown',
hoverable: 'false',
html:
'<svg width="14" height="13" viewBox="0 0 14 13" fill="none" xmlns="http://www.w3.org/2000/svg">\n' +
'<path d="M6.95 12.6496L9.75 5.26628H11.0333L13.8333 12.6496H12.55L11.9 10.7663H8.91667L8.25 12.6496H6.95ZM9.28333 9.69961H11.5L10.4167 6.64961H10.3667L9.28333 9.69961ZM2.08333 10.7996L1.21667 9.93294L4.33333 6.83294C3.94444 6.39961 3.60556 5.95228 3.31667 5.49094C3.02778 5.03005 2.77222 4.54405 2.55 4.03294H3.83333C4.02222 4.41072 4.22222 4.74672 4.43333 5.04094C4.64444 5.33561 4.89444 5.64405 5.18333 5.96628C5.63889 5.47739 6.01667 4.97472 6.31667 4.45828C6.61667 3.94139 6.86667 3.3885 7.06667 2.79961H0.25V1.58294H4.55V0.349609H5.78333V1.58294H10.0833V2.79961H8.3C8.07778 3.53294 7.78333 4.24116 7.41667 4.92428C7.05 5.60783 6.59444 6.25516 6.05 6.86628L7.53333 8.36628L7.06667 9.63294L5.16667 7.73294L2.08333 10.7996Z" fill="currentColor"/>\n' +
'</svg>',
position: 'right',
items: [
{
label: 'English',
to: '/',
},
{
label: 'Russian',
to: '/ru',
},
{
label: 'Chinese',
to: '/zh',
},
],
}
]
},
}
module.exports = config