Skip to content

Commit e94ff9b

Browse files
committed
move to env variable for deciding lang
1 parent b34ab4e commit e94ff9b

File tree

4 files changed

+370
-364
lines changed

4 files changed

+370
-364
lines changed

docusaurus.config.en.js

Lines changed: 343 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,343 @@
1+
import { themes } from "prism-react-renderer";
2+
import math from "remark-math";
3+
import katex from "rehype-katex";
4+
import chHeader from "./plugins/header.js";
5+
import fixLinks from "./src/hooks/fixLinks.js";
6+
7+
// Helper function to skip over index.md files.
8+
function skipIndex(items) {
9+
return items.filter(({ type, id }) => {
10+
return type !== "doc" || !id.match(/index$/);
11+
});
12+
}
13+
14+
/** @type {import('@docusaurus/types').Config} */
15+
const config = {
16+
scripts: [
17+
{
18+
src: "https://widget.kapa.ai/kapa-widget.bundle.js",
19+
"data-website-id": "c0b5f156-1e92-49df-8252-adacc9feb21b",
20+
"data-project-name": "ClickHouse",
21+
"data-project-color": "#151515",
22+
"data-project-logo":
23+
"https://avatars.githubusercontent.com/u/54801242?s=200&v=4",
24+
"data-modal-disclaimer":
25+
"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.",
26+
"data-modal-example-questions":
27+
"How to speed up queries?,How to use materialized views?",
28+
"data-kapa-branding-hide": "true",
29+
async: true,
30+
defer: true, // execute after document parsing, but before firing DOMContentLoaded event
31+
},
32+
],
33+
// Settings for Docusaurus Faster - build optimizations
34+
future: {
35+
experimental_faster: {
36+
swcJsLoader: true,
37+
swcJsMinimizer: true,
38+
swcHtmlMinimizer: true,
39+
lightningCssMinimizer: true,
40+
rspackBundler: true,
41+
mdxCrossCompilerCache: true,
42+
},
43+
},
44+
title: "ClickHouse Docs",
45+
tagline:
46+
"Documentation, quick starts, user guides, technical references, FAQs and more...",
47+
url: "https://clickhouse.com",
48+
// url: process.env.VERCEL_URL ? `https://${process.env.VERCEL_URL}` : 'https://bookish-disco-5997zvo.pages.github.io',
49+
baseUrl: "/docs/",
50+
baseUrlIssueBanner: true,
51+
onBrokenLinks: "warn",
52+
onBrokenMarkdownLinks: "warn",
53+
onDuplicateRoutes: "throw",
54+
onBrokenAnchors: "warn",
55+
favicon: "img/docs_favicon.ico",
56+
organizationName: "ClickHouse",
57+
trailingSlash: false,
58+
i18n: {
59+
defaultLocale: "en",
60+
locales: ["en"],
61+
path: "i18n",
62+
localeConfigs: {
63+
en: {
64+
htmlLang: "en",
65+
path: "en",
66+
},
67+
},
68+
},
69+
staticDirectories: ["static"],
70+
projectName: "clickhouse-docs",
71+
markdown: {
72+
mermaid: true,
73+
},
74+
themes: ["@docusaurus/theme-mermaid"],
75+
presets: [
76+
[
77+
"classic",
78+
/** @type {import('@docusaurus/preset-classic').Options} */
79+
({
80+
docs: {
81+
admonitions: {
82+
keywords: [
83+
"note",
84+
"tip",
85+
"info",
86+
"caution",
87+
"danger",
88+
"experimental",
89+
"obsolete",
90+
"warning",
91+
"success",
92+
"important",
93+
"secondary",
94+
],
95+
},
96+
sidebarPath: require.resolve("./sidebars.js"),
97+
// Implements a custom sidebar to override default behaviour where index.md page shows underneath the category name.
98+
// With this sidebar the category name is clickable to show the index.md contents.
99+
async sidebarItemsGenerator({
100+
defaultSidebarItemsGenerator,
101+
...args
102+
}) {
103+
const sidebarItems = await defaultSidebarItemsGenerator(args);
104+
return skipIndex(sidebarItems);
105+
},
106+
editCurrentVersion: true,
107+
breadcrumbs: true,
108+
editUrl: ({ docPath }) => {
109+
if (docPath === "index.md") return false;
110+
if (
111+
docPath.includes("development") ||
112+
docPath.includes("engines") ||
113+
docPath.includes("getting-started") ||
114+
docPath.includes("interfaces") ||
115+
docPath.includes("operations") ||
116+
docPath.includes("sql-reference")
117+
) {
118+
return (
119+
"https://github.com/ClickHouse/ClickHouse/tree/master/docs/en/" +
120+
docPath
121+
);
122+
} else {
123+
return (
124+
"https://github.com/ClickHouse/clickhouse-docs/blob/main/docs/" +
125+
docPath
126+
);
127+
}
128+
},
129+
showLastUpdateTime: false,
130+
sidebarCollapsed: true,
131+
routeBasePath: "/",
132+
remarkPlugins: [math],
133+
beforeDefaultRemarkPlugins: [fixLinks],
134+
rehypePlugins: [katex],
135+
},
136+
blog: {
137+
path: "knowledgebase",
138+
blogTitle: "ClickHouse Knowledge Base",
139+
blogDescription: "Knowledge Base",
140+
blogSidebarTitle: "All KB articles",
141+
routeBasePath: "/knowledgebase",
142+
postsPerPage: 10,
143+
blogSidebarCount: "ALL",
144+
feedOptions: {
145+
type: "all",
146+
title: "ClickHouse Knowledge Base Feed",
147+
description:
148+
"Feed of articles posted to the ClickHouse Knowledge Base",
149+
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.`,
150+
language: "en",
151+
createFeedItems: async (params) => {
152+
const { blogPosts, defaultCreateFeedItems, ...rest } = params;
153+
return defaultCreateFeedItems({
154+
// keep only the 10 most recent blog posts in the feed
155+
blogPosts: blogPosts.filter((item, index) => index < 10),
156+
...rest,
157+
});
158+
},
159+
},
160+
editUrl: ({ blogPath }) => {
161+
return (
162+
"https://github.com/ClickHouse/clickhouse-docs/blob/main/knowledgebase/" +
163+
blogPath
164+
);
165+
},
166+
},
167+
theme: {
168+
customCss: [require.resolve("./src/css/custom.scss")],
169+
},
170+
gtag: {
171+
trackingID: "G-KF1LLRTQ5Q",
172+
},
173+
}),
174+
],
175+
],
176+
// Inserts tags into the <head></head>
177+
headTags: [
178+
{
179+
// Ask AI component
180+
tagName: "link",
181+
attributes: {
182+
href: "https://widget.kapa.ai",
183+
rel: "preconnect", // preemptively initiate a connection to resource
184+
},
185+
},
186+
{
187+
// Google's CDN. Caches all 'static' files in a server near to you
188+
// to reduce load times.
189+
tagName: "link",
190+
attributes: {
191+
href: "https://www.gstatic.com",
192+
rel: "preconnect",
193+
crossorigin: "use-credentials",
194+
},
195+
},
196+
{
197+
tagName: "link",
198+
attributes: {
199+
href: "https://www.googletagmanager.com",
200+
rel: "preconnect",
201+
},
202+
},
203+
],
204+
themeConfig:
205+
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
206+
({
207+
algolia: {
208+
appId: "5H9UG7CX5W",
209+
apiKey: "4a7bf25cf3edbef29d78d5e1eecfdca5",
210+
indexName: "clickhouse",
211+
contextualSearch: false,
212+
searchPagePath: "search",
213+
},
214+
image: "img/docs_social_share.png",
215+
icon: "/img/gareth.png",
216+
docs: {
217+
sidebar: {
218+
autoCollapseCategories: true,
219+
},
220+
},
221+
// autoCollapseSidebarCategories: true,
222+
navbar: {
223+
hideOnScroll: false,
224+
logo: {
225+
alt: "ClickHouse",
226+
src: "img/ch_logo_docs.svg",
227+
srcDark: "img/ch_logo_docs_dark.svg",
228+
href: "https://clickhouse.com/",
229+
},
230+
items: [],
231+
},
232+
footer: {
233+
style: "light",
234+
links: [
235+
{
236+
label: "Trademark",
237+
to: "https://clickhouse.com/legal/trademark-policy",
238+
},
239+
{
240+
label: "Privacy",
241+
to: "https://clickhouse.com/legal/privacy-policy",
242+
},
243+
{
244+
label: "Security",
245+
to: "https://trust.clickhouse.com/",
246+
},
247+
{
248+
label: "Terms of Service",
249+
to: "https://clickhouse.com/legal/agreements/terms-of-service",
250+
},
251+
],
252+
copyright: `© 2016&ndash;${new Date().getFullYear()} ClickHouse, Inc.`,
253+
},
254+
prism: {
255+
theme: themes.darkTheme,
256+
darkTheme: themes.darkTheme,
257+
additionalLanguages: ["java", "cpp", "rust"],
258+
magicComments: [
259+
// Remember to extend the default highlight class name as well!
260+
{
261+
className: "theme-code-block-highlighted-line",
262+
line: "highlight-next-line",
263+
block: { start: "highlight-start", end: "highlight-end" },
264+
},
265+
],
266+
},
267+
colorMode: {
268+
disableSwitch: false,
269+
respectPrefersColorScheme: true,
270+
defaultMode: "dark",
271+
},
272+
/* announcementBar: {
273+
id: 'support_us',
274+
content:
275+
'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>',
276+
backgroundColor: '#0057b7',
277+
textColor: '#ffffff',
278+
isCloseable: false,
279+
},
280+
*/
281+
}),
282+
283+
plugins: [
284+
"docusaurus-plugin-sass",
285+
function (context, options) {
286+
return {
287+
name: "docusaurus-plugin",
288+
async postBuild({ siteConfig = {}, routesPaths = [], outDir }) {
289+
// Print out to console all the rendered routes.
290+
routesPaths.map((route) => {
291+
//console.log(route)
292+
});
293+
},
294+
};
295+
},
296+
// [
297+
// N.B - If you need to redirect a page please do so from vercel.json
298+
// '@docusaurus/plugin-client-redirects',
299+
// {
300+
// },
301+
// ],
302+
[
303+
"vercel-analytics",
304+
{
305+
debug: false,
306+
mode: "auto",
307+
},
308+
],
309+
chHeader,
310+
],
311+
customFields: {
312+
blogSidebarLink: "/docs/knowledgebase", // Used for KB article page
313+
galaxyApiEndpoint:
314+
process.env.NEXT_PUBLIC_GALAXY_API_ENDPOINT || "http://localhost:3000",
315+
secondaryNavItems: [
316+
{
317+
type: "dropdown",
318+
hoverable: "false",
319+
html:
320+
'<svg width="14" height="13" viewBox="0 0 14 13" fill="none" xmlns="http://www.w3.org/2000/svg">\n' +
321+
'<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' +
322+
"</svg>",
323+
position: "right",
324+
items: [
325+
{
326+
label: "English",
327+
to: "/",
328+
},
329+
{
330+
label: "Russian",
331+
to: "/ru",
332+
},
333+
{
334+
label: "Chinese",
335+
to: "/zh",
336+
},
337+
],
338+
},
339+
],
340+
},
341+
};
342+
343+
module.exports = config;
File renamed without changes.

0 commit comments

Comments
 (0)