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
......@@ -30,7 +30,7 @@ const config = {
tagline: 'Dinky 为 Apache Flink 而生,让 Flink SQL 纵享丝滑', // 网站标语 | Tagline for your website
url: 'http://www.dlink.top/', // 网站网址 | Your website's URL
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
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'
......@@ -39,11 +39,11 @@ const config = {
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.
deploymentBranch: 'main', // GitHub Pages 的部署分支。 用于部署命令。 | The branch to deploy to GitHub Pages. Command for deployment.
customFields:{ // 自定义字段 | Custom fields
customFields: { // 自定义字段 | Custom fields
structTitle: 'Dinky',
structSubTitle: 'Dinky 为 Apache Flink 而生,让 Flink SQL 纵享丝滑',
// structDescription: custom_fields.structDesc(),
learningMore:'https://space.bilibili.com/366484959/video'
learningMore: 'https://space.bilibili.com/366484959/video'
},
i18n: {
defaultLocale: 'zh-cn',
......@@ -60,6 +60,22 @@ const config = {
// },
},
},
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',
......@@ -85,7 +101,7 @@ const config = {
'**/*.test.{js,jsx,ts,tsx}',
'**/__tests__/**',
],
sortPosts:"descending", // 博客主页分页的排序规则(会根据时间排序) 降序: 'descending' 升序: 'ascending' | Governs the direction of blog post sorting.
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: 此属性 默认是当前时间
......@@ -114,8 +130,14 @@ const config = {
isCloseable: false,
},
hideOnScroll: false, // 滚动时是否隐藏 | Whether to hide the sidebar on scroll
hideableSidebar: true, // 是否隐藏侧边栏 | Whether to hide the sidebar in mobile
autoCollapseSidebarCategories: true, // 点击另一个分类时自动折叠当前分类 | Click another category will automatically collapse the current category
// hideableSidebar: true, // 是否隐藏侧边栏 | Whether to hide the sidebar in mobile
docs: {
sidebar: {
hideable: true ,// 是否隐藏侧边栏 | Whether to hide the sidebar in mobile
autoCollapseCategories: true , // 点击另一个分类时自动折叠当前分类 | Click another category will automatically collapse the current category
}
},
navbar: {
title: 'Dinky',
logo: {
......@@ -143,10 +165,6 @@ const config = {
label: "0.6",
to: "/docs/intro",
},
// {
// label: "0.6",
// to: "/docs/0.6/intro",
// },
{
label: "All Versions",
to: "/versions",
......@@ -178,21 +196,16 @@ const config = {
},
],
},
{
/*{
to: '/blog',
position: 'right',
label: '博客',
// activeBaseRegex: `/*/`,
},
// activeBaseRegex: `/!*!/`,
},*/
{
type: 'localeDropdown',
position: 'right',
},
// {
// to: 'blog',
// label: '博客',
// position: 'right'
// },
{
href: 'https://github.com/DataLinkDC/dlink',
label: 'GitHub',
......
......@@ -14,9 +14,10 @@
"write-heading-ids": "docusaurus write-heading-ids"
},
"dependencies": {
"@docusaurus/core": "2.0.0-beta.18",
"@docusaurus/plugin-content-docs": "2.0.0-beta.18",
"@docusaurus/preset-classic": "2.0.0-beta.18",
"@docusaurus/core": "^2.2.0",
"@docusaurus/plugin-content-docs": "^2.2.0",
"@docusaurus/preset-classic": "^2.2.0",
"@easyops-cn/docusaurus-search-local": "^0.33.5",
"@mdx-js/react": "^1.6.22",
"clsx": "^1.1.1",
"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