Unverified Commit dbf85ae4 authored by zhu-mingye's avatar zhu-mingye Committed by GitHub

[Feature][doc] added docs search && upgrade docusaurus version to 2.2.0 (#1319)

* add docs search * delete blog config
parent 6bd1ed14
...@@ -26,257 +26,270 @@ const darkCodeTheme = require('prism-react-renderer/themes/dracula'); ...@@ -26,257 +26,270 @@ const darkCodeTheme = require('prism-react-renderer/themes/dracula');
/** @type {import('@docusaurus/types').Config} */ /** @type {import('@docusaurus/types').Config} */
const config = { const config = {
title: 'Dinky', //网站标题 | Site title title: 'Dinky', //网站标题 | Site title
tagline: 'Dinky 为 Apache Flink 而生,让 Flink SQL 纵享丝滑', // 网站标语 | Tagline for your website tagline: 'Dinky 为 Apache Flink 而生,让 Flink SQL 纵享丝滑', // 网站标语 | Tagline for your website
url: 'http://www.dlink.top/', // 网站网址 | Your website's URL url: 'http://www.dlink.top/', // 网站网址 | Your website's URL
baseUrl: '/', // 站点的相对路径 可将其视为是主机名后的路径 | Path to your website baseUrl: '/', // 站点的相对路径 可将其视为是主机名后的路径 | Path to your website
staticDirectories: ['static/img','blog/blog_img'], // 静态文件目录 | Path to static files staticDirectories: ['static/img', 'blog/blog_img'], // 静态文件目录 | Path to static files
// trailingSlash: true, //此选项允许您自定义 URL/链接后是否添加结尾斜杠 | Whether to append a trailing slash to the URL when rendering URLs // trailingSlash: true, //此选项允许您自定义 URL/链接后是否添加结尾斜杠 | Whether to append a trailing slash to the URL when rendering URLs
onBrokenLinks: 'ignore', // Docusaurus 在检测到无效链接时的行为 | Docusaurus behavior when invalid links are detected -> 类型:'ignore' | 'log' | 'warn' | 'error' | 'throw' | onBrokenLinks: 'ignore', // Docusaurus 在检测到无效链接时的行为 | Docusaurus behavior when invalid links are detected -> 类型:'ignore' | 'log' | 'warn' | 'error' | 'throw' |
onBrokenMarkdownLinks: 'warn', // Docusaurus 在检测到无效 Markdown 链接时的行为 | Docusaurus behavior when detecting invalid markdown links -> 类型:'ignore' | 'log' | 'warn' | 'error' | 'throw' onBrokenMarkdownLinks: 'warn', // Docusaurus 在检测到无效 Markdown 链接时的行为 | Docusaurus behavior when detecting invalid markdown links -> 类型:'ignore' | 'log' | 'warn' | 'error' | 'throw'
onDuplicateRoutes: 'warn', // Docusaurus 在检测到重复的路由时的行为 | Behavior of docusaurus when duplicate routes are detected -> 类型:'ignore' | 'log' | 'warn' | 'error' | 'throw' onDuplicateRoutes: 'warn', // Docusaurus 在检测到重复的路由时的行为 | Behavior of docusaurus when duplicate routes are detected -> 类型:'ignore' | 'log' | 'warn' | 'error' | 'throw'
favicon: 'dinky_logo.svg', // 左侧logo | left logo favicon: 'dinky_logo.svg', // 左侧logo | left logo
organizationName: 'DataLinkDC', // 拥有此源的 GitHub 用户或组织。 用于部署命令。 | The GitHub user or organization that owns this source. Command for deployment. organizationName: 'DataLinkDC', // 拥有此源的 GitHub 用户或组织。 用于部署命令。 | The GitHub user or organization that owns this source. Command for deployment.
projectName: 'dlink', // GitHub 源的名称。 用于部署命令。 | The name of the GitHub repository. Command for deployment. projectName: 'dlink', // GitHub 源的名称。 用于部署命令。 | The name of the GitHub repository. Command for deployment.
deploymentBranch: 'main', // GitHub Pages 的部署分支。 用于部署命令。 | The branch to deploy to GitHub Pages. Command for deployment. deploymentBranch: 'main', // GitHub Pages 的部署分支。 用于部署命令。 | The branch to deploy to GitHub Pages. Command for deployment.
customFields:{ // 自定义字段 | Custom fields customFields: { // 自定义字段 | Custom fields
structTitle: 'Dinky', structTitle: 'Dinky',
structSubTitle: 'Dinky 为 Apache Flink 而生,让 Flink SQL 纵享丝滑', structSubTitle: 'Dinky 为 Apache Flink 而生,让 Flink SQL 纵享丝滑',
// structDescription: custom_fields.structDesc(), // structDescription: custom_fields.structDesc(),
learningMore:'https://space.bilibili.com/366484959/video' learningMore: 'https://space.bilibili.com/366484959/video'
},
i18n: {
defaultLocale: 'zh-cn',
locales: ['zh-cn'],
// locales: ['zh-cn','en'],
localeConfigs: {
'zh-cn': {
label: "简体中文",
direction: 'ltr',
},
// 'en': {
// label: "English",
// direction: 'ltr',
// },
}, },
}, i18n: {
presets: [ defaultLocale: 'zh-cn',
[ locales: ['zh-cn'],
'classic', // locales: ['zh-cn','en'],
/** @type {import('@docusaurus/preset-classic').Options} */ localeConfigs: {
({ 'zh-cn': {
docs: { label: "简体中文",
sidebarPath: require.resolve('./sidebars.js'), direction: 'ltr',
sidebarCollapsible: true, },
// Please change this to your repo. // 'en': {
editUrl: ({locale, versionDocsDirPath, docPath}) => { // label: "English",
if (locale !== 'zh-cn') { // direction: 'ltr',
return `https://github.com/DataLinkDC/dlink/tree/master/docs/i18n/${locale}/${docPath}`; // },
}
return `https://github.com/DataLinkDC/dlink/tree/master/docs/${versionDocsDirPath}/${docPath}`;
},
},
blog: {
showReadingTime: true, // 展示阅读时间 | show read time
include: ['**/*.{md,mdx}'],
exclude: [
'**/_*.{js,jsx,ts,tsx,md,mdx}',
'**/_*/**',
'**/*.test.{js,jsx,ts,tsx}',
'**/__tests__/**',
],
sortPosts:"descending", // 博客主页分页的排序规则(会根据时间排序) 降序: 'descending' 升序: 'ascending' | Governs the direction of blog post sorting.
postsPerPage: 20, // 博客主页的前{count}篇文章数 | the blog homepage show limit count
readingTime: ({content, frontMatter, defaultReadingTime}) =>
defaultReadingTime({content, options: {wordsPerMinute: 300}}), // 阅读时间 md文件中如果不写 date: 此属性 默认是当前时间
// Please change this to your repo.
// editUrl: ({locale, versionDocsDirPath, docPath}) => { // 博客页面修改编辑按钮
// if (locale !== 'zh-cn') {
// return `https://github.com/DataLinkDC/dlink/tree/master/docs/i18n/${locale}/${docPath}`;
// }
// return `https://github.com/DataLinkDC/dlink/tree/master/docs/${versionDocsDirPath}/${docPath}`;
// },
},
theme: {
customCss: require.resolve('./src/css/custom.css'), // 自定义css文件
}, },
}), },
themes: [
[
require.resolve("@easyops-cn/docusaurus-search-local"),
/** @type {import("@easyops-cn/docusaurus-search-local").PluginOptions} */
({
// config url is: https://github.com/easyops-cn/docusaurus-search-local#theme-options
hashed: true,
indexDocs: true,
indexPages: true,
highlightSearchTermsOnTargetPage: false, // Highlight search terms on target page.
explicitSearchResultPath: true,
searchBarPosition: "right",
hideSearchBarWithNoSearchContext: true,
}),
],
],
presets: [
[
'classic',
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
sidebarPath: require.resolve('./sidebars.js'),
sidebarCollapsible: true,
// Please change this to your repo.
editUrl: ({locale, versionDocsDirPath, docPath}) => {
if (locale !== 'zh-cn') {
return `https://github.com/DataLinkDC/dlink/tree/master/docs/i18n/${locale}/${docPath}`;
}
return `https://github.com/DataLinkDC/dlink/tree/master/docs/${versionDocsDirPath}/${docPath}`;
},
},
blog: {
showReadingTime: true, // 展示阅读时间 | show read time
include: ['**/*.{md,mdx}'],
exclude: [
'**/_*.{js,jsx,ts,tsx,md,mdx}',
'**/_*/**',
'**/*.test.{js,jsx,ts,tsx}',
'**/__tests__/**',
],
sortPosts: "descending", // 博客主页分页的排序规则(会根据时间排序) 降序: 'descending' 升序: 'ascending' | Governs the direction of blog post sorting.
postsPerPage: 20, // 博客主页的前{count}篇文章数 | the blog homepage show limit count
readingTime: ({content, frontMatter, defaultReadingTime}) =>
defaultReadingTime({content, options: {wordsPerMinute: 300}}), // 阅读时间 md文件中如果不写 date: 此属性 默认是当前时间
// Please change this to your repo.
// editUrl: ({locale, versionDocsDirPath, docPath}) => { // 博客页面修改编辑按钮
// if (locale !== 'zh-cn') {
// return `https://github.com/DataLinkDC/dlink/tree/master/docs/i18n/${locale}/${docPath}`;
// }
// return `https://github.com/DataLinkDC/dlink/tree/master/docs/${versionDocsDirPath}/${docPath}`;
// },
},
theme: {
customCss: require.resolve('./src/css/custom.css'), // 自定义css文件
},
}),
],
], ],
],
themeConfig: themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */ /** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({ ({
announcementBar: { announcementBar: {
id: 'announcementBar-2', // Increment on change id: 'announcementBar-2', // Increment on change
content: `⭐️ &nbsp; If you like Dinky , give it a star on <a target="_blank" rel="noopener noreferrer" href="https://github.com/DataLinkDC/dlink">GitHub</a>`, content: `⭐️ &nbsp; If you like Dinky , give it a star on <a target="_blank" rel="noopener noreferrer" href="https://github.com/DataLinkDC/dlink">GitHub</a>`,
backgroundColor: "#BBDFFF", backgroundColor: "#BBDFFF",
isCloseable: false, isCloseable: false,
}, },
hideOnScroll: false, // 滚动时是否隐藏 | Whether to hide the sidebar on scroll hideOnScroll: false, // 滚动时是否隐藏 | Whether to hide the sidebar on scroll
hideableSidebar: true, // 是否隐藏侧边栏 | Whether to hide the sidebar in mobile // hideableSidebar: true, // 是否隐藏侧边栏 | Whether to hide the sidebar in mobile
autoCollapseSidebarCategories: true, // 点击另一个分类时自动折叠当前分类 | Click another category will automatically collapse the current category docs: {
navbar: { sidebar: {
title: 'Dinky', hideable: true ,// 是否隐藏侧边栏 | Whether to hide the sidebar in mobile
logo: { autoCollapseCategories: true , // 点击另一个分类时自动折叠当前分类 | Click another category will automatically collapse the current category
alt: 'Dinky',
src: 'side_dinky.svg', }
}, },
items: [ navbar: {
{ title: 'Dinky',
to: '/', logo: {
position: 'right', alt: 'Dinky',
label: '主页', src: 'side_dinky.svg',
title: '主页', },
activeBaseRegex: `^/$`, items: [
}, {
{ to: '/',
position: 'right', position: 'right',
label: '文档', label: '主页',
to: "/docs/intro", title: '主页',
items: [ activeBaseRegex: `^/$`,
{ },
label: "Next", {
to: "/docs/next/intro", position: 'right',
}, label: '文档',
{ to: "/docs/intro",
label: "0.6", items: [
to: "/docs/intro", {
}, label: "Next",
// { to: "/docs/next/intro",
// label: "0.6", },
// to: "/docs/0.6/intro", {
// }, label: "0.6",
{ to: "/docs/intro",
label: "All Versions", },
to: "/versions", {
}, label: "All Versions",
], to: "/versions",
}, },
{ ],
to: '/download/download', },
position: 'right', {
label: '下载', to: '/download/download',
activeBaseRegex: `/download/`, position: 'right',
}, label: '下载',
{ activeBaseRegex: `/download/`,
label: '开发者指南', },
to: '/docs/next/developer_guide/contribution/how_contribute', {
position: 'right', label: '开发者指南',
items: [ to: '/docs/next/developer_guide/contribution/how_contribute',
{ position: 'right',
label: "如何参与", items: [
to: "/docs/next/developer_guide/contribution/how_contribute", {
}, label: "如何参与",
{ to: "/docs/next/developer_guide/contribution/how_contribute",
label: "本地调试", },
to: "/docs/next/developer_guide/local_debug", {
}, label: "本地调试",
{ to: "/docs/next/developer_guide/local_debug",
label: "远程调试", },
to: "/docs/next/developer_guide/remote_debug", {
}, label: "远程调试",
], to: "/docs/next/developer_guide/remote_debug",
}, },
{ ],
to: '/blog', },
position: 'right', /*{
label: '博客', to: '/blog',
// activeBaseRegex: `/*/`, position: 'right',
}, label: '博客',
{ // activeBaseRegex: `/!*!/`,
type: 'localeDropdown', },*/
position: 'right', {
}, type: 'localeDropdown',
// { position: 'right',
// to: 'blog', },
// label: '博客', {
// position: 'right' href: 'https://github.com/DataLinkDC/dlink',
// }, label: 'GitHub',
{ position: 'right',
href: 'https://github.com/DataLinkDC/dlink', },
label: 'GitHub', ],
position: 'right', },
}, footer: {
], style: 'dark',
}, links: [
footer: { {
style: 'dark', title: 'Docs',
links: [ items: [
{ {
title: 'Docs', label: '文档首页',
items: [ to: '/docs/intro',
{ },
label: '文档首页', {
to: '/docs/intro', label: 'Open Api',
}, to: '/docs/administrator_guide/studio/openapi',
{ },
label: 'Open Api', ],
to: '/docs/administrator_guide/studio/openapi', },
}, {
], title: 'Community',
}, items: [
{ {
title: 'Community', label: 'Discussions',
items: [ href: 'https://github.com/DataLinkDC/dlink/discussions',
{ },
label: 'Discussions', {
href: 'https://github.com/DataLinkDC/dlink/discussions', label: 'Issue',
}, href: 'https://github.com/DataLinkDC/dlink/issues',
{ },
label: 'Issue', {
href: 'https://github.com/DataLinkDC/dlink/issues', label: 'Pull Request',
}, href: 'https://github.com/DataLinkDC/dlink/pulls',
{ },
label: 'Pull Request', ],
href: 'https://github.com/DataLinkDC/dlink/pulls', },
}, {
], title: 'More',
}, items: [
{ {
title: 'More', label: 'GitHub',
items: [ href: 'https://github.com/DataLinkDC/dlink',
{ },
label: 'GitHub', {
href: 'https://github.com/DataLinkDC/dlink', label: '博客',
}, to: '/blog',
{ },
label: '博客', ],
to: '/blog', },
}, ],
], logo: {
}, alt: 'Dinky',
], src: 'side_dinky.svg',
logo: { width: 100,
alt: 'Dinky', height: 30,
src: 'side_dinky.svg', },
width: 100, copyright: `Copyright © ${new Date().getFullYear()} Dinky, Inc. DataLinkDC.`,
height: 30, },
}, prism: {
copyright: `Copyright © ${new Date().getFullYear()} Dinky, Inc. DataLinkDC.`, theme: lightCodeTheme,
}, darkTheme: darkCodeTheme,
prism: { },
theme: lightCodeTheme, }),
darkTheme: darkCodeTheme,
},
}),
plugins: [ plugins: [
'docusaurus-plugin-less', 'docusaurus-plugin-less',
[ [
'@docusaurus/plugin-content-docs', '@docusaurus/plugin-content-docs',
{ {
id: 'download', id: 'download',
path: 'download', path: 'download',
routeBasePath: 'download', routeBasePath: 'download',
editUrl: ({locale, versionDocsDirPath, docPath}) => { editUrl: ({locale, versionDocsDirPath, docPath}) => {
if (locale !== 'zh-cn') { if (locale !== 'zh-cn') {
return `https://github.com/DataLinkDC/dlink/tree/master/docs/i18n/${locale}/${docPath}`; return `https://github.com/DataLinkDC/dlink/tree/master/docs/i18n/${locale}/${docPath}`;
} }
return `https://github.com/DataLinkDC/dlink/tree/master/docs/${versionDocsDirPath}/${docPath}`; return `https://github.com/DataLinkDC/dlink/tree/master/docs/${versionDocsDirPath}/${docPath}`;
},
sidebarPath: require.resolve('./sidebars.js'),
}, },
sidebarPath: require.resolve('./sidebars.js'), ],
},
],
] ]
}; };
......
...@@ -14,9 +14,10 @@ ...@@ -14,9 +14,10 @@
"write-heading-ids": "docusaurus write-heading-ids" "write-heading-ids": "docusaurus write-heading-ids"
}, },
"dependencies": { "dependencies": {
"@docusaurus/core": "2.0.0-beta.18", "@docusaurus/core": "^2.2.0",
"@docusaurus/plugin-content-docs": "2.0.0-beta.18", "@docusaurus/plugin-content-docs": "^2.2.0",
"@docusaurus/preset-classic": "2.0.0-beta.18", "@docusaurus/preset-classic": "^2.2.0",
"@easyops-cn/docusaurus-search-local": "^0.33.5",
"@mdx-js/react": "^1.6.22", "@mdx-js/react": "^1.6.22",
"clsx": "^1.1.1", "clsx": "^1.1.1",
"docusaurus-plugin-less": "^2.0.2", "docusaurus-plugin-less": "^2.0.2",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment