Skip to content

Commit 5258ab6

Browse files
committed
improvements
1 parent 1659341 commit 5258ab6

File tree

7 files changed

+777
-22
lines changed

7 files changed

+777
-22
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,4 @@ docs/whats-new/changelog/index.md
5757
!toc.json
5858
**.translated
5959
**.translate
60+
ClickHouse/

docs/whats-new/changelog/index.md

Lines changed: 407 additions & 0 deletions
Large diffs are not rendered by default.

docusaurus.config.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,13 @@ const config = {
5757
trailingSlash: false,
5858
i18n: {
5959
defaultLocale: "en",
60-
locales: ["en", "jp"],
60+
locales: ["en"],
6161
path: "i18n",
6262
localeConfigs: {
6363
en: {
6464
htmlLang: "en",
6565
path: "en",
6666
},
67-
jp: {
68-
htmlLang: "jp",
69-
path: "jp",
70-
},
7167
},
7268
},
7369
staticDirectories: ["static"],

docusaurus.jp.config.js

Lines changed: 324 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,324 @@
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+
"ドキュメント、クイックスタートガイド、ユーザーガイド、技術リファレンス、FAQ など、多様な情報をご提供します。",
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: "/jp/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: "jp",
60+
locales: ["jp", "en"],
61+
path: "i18n",
62+
localeConfigs: {
63+
jp: {
64+
htmlLang: "jp",
65+
path: "jp",
66+
},
67+
en: {
68+
htmlLang: "en",
69+
path: "en",
70+
},
71+
},
72+
},
73+
staticDirectories: ["static"],
74+
projectName: "clickhouse-docs",
75+
markdown: {
76+
mermaid: true,
77+
},
78+
themes: ["@docusaurus/theme-mermaid"],
79+
presets: [
80+
[
81+
"classic",
82+
/** @type {import('@docusaurus/preset-classic').Options} */
83+
({
84+
docs: {
85+
admonitions: {
86+
keywords: [
87+
"note",
88+
"tip",
89+
"info",
90+
"caution",
91+
"danger",
92+
"experimental",
93+
"obsolete",
94+
"warning",
95+
"success",
96+
"important",
97+
"secondary",
98+
],
99+
},
100+
sidebarPath: require.resolve("./sidebars.js"),
101+
// Implements a custom sidebar to override default behaviour where index.md page shows underneath the category name.
102+
// With this sidebar the category name is clickable to show the index.md contents.
103+
async sidebarItemsGenerator({
104+
defaultSidebarItemsGenerator,
105+
...args
106+
}) {
107+
const sidebarItems = await defaultSidebarItemsGenerator(args);
108+
return skipIndex(sidebarItems);
109+
},
110+
editCurrentVersion: true,
111+
breadcrumbs: true,
112+
editUrl: ({ docPath }) => {
113+
if (docPath === "index.md") return false;
114+
if (
115+
docPath.includes("development") ||
116+
docPath.includes("engines") ||
117+
docPath.includes("getting-started") ||
118+
docPath.includes("interfaces") ||
119+
docPath.includes("operations") ||
120+
docPath.includes("sql-reference")
121+
) {
122+
return (
123+
"https://github.com/ClickHouse/ClickHouse/tree/master/docs/en/" +
124+
docPath
125+
);
126+
} else {
127+
return (
128+
"https://github.com/ClickHouse/clickhouse-docs/blob/main/docs/" +
129+
docPath
130+
);
131+
}
132+
},
133+
showLastUpdateTime: false,
134+
sidebarCollapsed: true,
135+
routeBasePath: "/",
136+
remarkPlugins: [math],
137+
beforeDefaultRemarkPlugins: [fixLinks],
138+
rehypePlugins: [katex],
139+
},
140+
blog: {
141+
path: "knowledgebase",
142+
blogTitle: "ClickHouse Knowledge Base",
143+
blogDescription: "Knowledge Base",
144+
blogSidebarTitle: "All KB articles",
145+
routeBasePath: "/knowledgebase",
146+
postsPerPage: 10,
147+
blogSidebarCount: "ALL",
148+
feedOptions: {
149+
type: "all",
150+
title: "ClickHouse Knowledge Base Feed",
151+
description:
152+
"Feed of articles posted to the ClickHouse Knowledge Base",
153+
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.`,
154+
language: "en",
155+
createFeedItems: async (params) => {
156+
const { blogPosts, defaultCreateFeedItems, ...rest } = params;
157+
return defaultCreateFeedItems({
158+
// keep only the 10 most recent blog posts in the feed
159+
blogPosts: blogPosts.filter((item, index) => index < 10),
160+
...rest,
161+
});
162+
},
163+
},
164+
editUrl: ({ blogPath }) => {
165+
return (
166+
"https://github.com/ClickHouse/clickhouse-docs/blob/main/knowledgebase/" +
167+
blogPath
168+
);
169+
},
170+
},
171+
theme: {
172+
customCss: [require.resolve("./src/css/custom.scss")],
173+
},
174+
gtag: {
175+
trackingID: "G-KF1LLRTQ5Q",
176+
},
177+
}),
178+
],
179+
],
180+
// Inserts tags into the <head></head>
181+
headTags: [
182+
{
183+
// Ask AI component
184+
tagName: "link",
185+
attributes: {
186+
href: "https://widget.kapa.ai",
187+
rel: "preconnect", // preemptively initiate a connection to resource
188+
},
189+
},
190+
{
191+
// Google's CDN. Caches all 'static' files in a server near to you
192+
// to reduce load times.
193+
tagName: "link",
194+
attributes: {
195+
href: "https://www.gstatic.com",
196+
rel: "preconnect",
197+
crossorigin: "use-credentials",
198+
},
199+
},
200+
{
201+
tagName: "link",
202+
attributes: {
203+
href: "https://www.googletagmanager.com",
204+
rel: "preconnect",
205+
},
206+
},
207+
],
208+
themeConfig:
209+
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
210+
({
211+
algolia: {
212+
appId: "5H9UG7CX5W",
213+
apiKey: "4a7bf25cf3edbef29d78d5e1eecfdca5",
214+
indexName: "clickhouse",
215+
contextualSearch: false,
216+
searchPagePath: "search",
217+
},
218+
image: "img/docs_social_share.png",
219+
icon: "/img/gareth.png",
220+
docs: {
221+
sidebar: {
222+
autoCollapseCategories: true,
223+
},
224+
},
225+
// autoCollapseSidebarCategories: true,
226+
navbar: {
227+
hideOnScroll: false,
228+
logo: {
229+
alt: "ClickHouse",
230+
src: "img/ch_logo_docs.svg",
231+
srcDark: "img/ch_logo_docs_dark.svg",
232+
href: "https://clickhouse.com/",
233+
},
234+
items: [],
235+
},
236+
footer: {
237+
style: "light",
238+
links: [
239+
{
240+
label: "Trademark",
241+
to: "https://clickhouse.com/legal/trademark-policy",
242+
},
243+
{
244+
label: "Privacy",
245+
to: "https://clickhouse.com/legal/privacy-policy",
246+
},
247+
{
248+
label: "Security",
249+
to: "https://trust.clickhouse.com/",
250+
},
251+
{
252+
label: "Terms of Service",
253+
to: "https://clickhouse.com/legal/agreements/terms-of-service",
254+
},
255+
],
256+
copyright: `© 2016&ndash;${new Date().getFullYear()} ClickHouse, Inc.`,
257+
},
258+
prism: {
259+
theme: themes.darkTheme,
260+
darkTheme: themes.darkTheme,
261+
additionalLanguages: ["java", "cpp", "rust"],
262+
magicComments: [
263+
// Remember to extend the default highlight class name as well!
264+
{
265+
className: "theme-code-block-highlighted-line",
266+
line: "highlight-next-line",
267+
block: { start: "highlight-start", end: "highlight-end" },
268+
},
269+
],
270+
},
271+
colorMode: {
272+
disableSwitch: false,
273+
respectPrefersColorScheme: true,
274+
defaultMode: "dark",
275+
},
276+
}),
277+
278+
plugins: [
279+
"docusaurus-plugin-sass",
280+
function (context, options) {
281+
return {
282+
name: "docusaurus-plugin",
283+
async postBuild({ siteConfig = {}, routesPaths = [], outDir }) {
284+
// Print out to console all the rendered routes.
285+
routesPaths.map((route) => {
286+
//console.log(route)
287+
});
288+
},
289+
};
290+
},
291+
[
292+
"vercel-analytics",
293+
{
294+
debug: false,
295+
mode: "auto",
296+
},
297+
],
298+
chHeader,
299+
],
300+
customFields: {
301+
blogSidebarLink: "/docs/knowledgebase", // Used for KB article page
302+
galaxyApiEndpoint:
303+
process.env.NEXT_PUBLIC_GALAXY_API_ENDPOINT || "http://localhost:3000",
304+
secondaryNavItems: [
305+
{
306+
type: "dropdown",
307+
hoverable: "false",
308+
html:
309+
'<svg width="14" height="13" viewBox="0 0 14 13" fill="none" xmlns="http://www.w3.org/2000/svg">\n' +
310+
'<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' +
311+
"</svg>",
312+
position: "right",
313+
items: [
314+
{
315+
label: "English",
316+
to: "/",
317+
},
318+
],
319+
},
320+
],
321+
},
322+
};
323+
324+
module.exports = config;

i18n/README.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
11
# Process to translate japanese
22

3-
1. Run translator
3+
1. Build docs locally to ensure all files exist
4+
5+
```bash
6+
yarn build
7+
```
8+
9+
2. Run translator
410

511
```bash
612
python3 /opt/clickhouse-docs/scripts/translate/translate.py --input-folder /opt/clickhouse-docs/docs --output-folder /opt/clickhouse-docs/i18n/ja --config ./languages/ja.json
713
```
814

9-
On completion, replace imports:
15+
3. Replace imports
1016

17+
For example, for `jp`
1118

1219
```bash
1320
# osx
14-
find . -type f -exec sed -i '' 's|@site/docs|@site/i18n/jp/docusaurus-plugin-content-docs/current|g' {} +
21+
LC_ALL=C.UTF-8 find . -type f -exec sed -i '' 's|@site/docs|@site/i18n/jp/docusaurus-plugin-content-docs/current|g' {} +
1522
# ubuntu
16-
find . -type f -exec sed -i 's|@site/docs|@site/i18n/jp/docusaurus-plugin-content-docs/current|g' {} +
23+
LC_ALL=C.UTF-8 find . -type f -exec sed -i 's|@site/docs|@site/i18n/jp/docusaurus-plugin-content-docs/current|g' {} +
1724
```
1825

1926
Build and fix issues.

0 commit comments

Comments
 (0)