Skip to content

Commit e6d17ae

Browse files
author
singi.qin
committed
feat: add local search
1 parent c8df965 commit e6d17ae

File tree

3 files changed

+11445
-32
lines changed

3 files changed

+11445
-32
lines changed

docusaurus.config.ts

Lines changed: 50 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ const config: Config = {
7373
// Replace with your project's social card
7474
image: 'img/docusaurus-social-card.jpg',
7575
navbar: {
76-
title: 'My Site',
76+
title: 'Singi',
7777
logo: {
7878
alt: 'My Site Logo',
7979
src: 'img/logo.svg',
@@ -96,53 +96,71 @@ const config: Config = {
9696
footer: {
9797
style: 'dark',
9898
links: [
99-
{
100-
title: 'Docs',
101-
items: [
102-
{
103-
label: 'Tutorial',
104-
to: '/docs/intro',
105-
},
106-
],
107-
},
108-
{
109-
title: 'Community',
110-
items: [
111-
{
112-
label: 'Stack Overflow',
113-
href: 'https://stackoverflow.com/questions/tagged/docusaurus',
114-
},
115-
{
116-
label: 'Discord',
117-
href: 'https://discordapp.com/invite/docusaurus',
118-
},
119-
{
120-
label: 'X',
121-
href: 'https://x.com/docusaurus',
122-
},
123-
],
124-
},
99+
// {
100+
// title: 'Docs',
101+
// items: [
102+
// {
103+
// label: 'Tutorial',
104+
// to: '/docs/intro',
105+
// },
106+
// ],
107+
// },
108+
// {
109+
// title: 'Community',
110+
// items: [
111+
// {
112+
// label: 'Stack Overflow',
113+
// href: 'https://stackoverflow.com/questions/tagged/docusaurus',
114+
// },
115+
// {
116+
// label: 'Discord',
117+
// href: 'https://discordapp.com/invite/docusaurus',
118+
// },
119+
// {
120+
// label: 'X',
121+
// href: 'https://x.com/docusaurus',
122+
// },
123+
// ],
124+
// },
125125
{
126126
title: 'More',
127127
items: [
128128
{
129129
label: 'Blog',
130130
to: '/blog',
131131
},
132-
{
133-
label: 'GitHub',
134-
href: 'https://github.com/facebook/docusaurus',
135-
},
132+
// {
133+
// label: 'GitHub',
134+
// href: 'https://github.com/facebook/docusaurus',
135+
// },
136136
],
137137
},
138138
],
139-
copyright: `Copyright © ${new Date().getFullYear()} My Project, Inc. Built with Docusaurus.`,
139+
copyright: `Copyright © ${new Date().getFullYear()} Singi, Inc. Built with Docusaurus.`,
140140
},
141141
prism: {
142142
theme: prismThemes.github,
143143
darkTheme: prismThemes.dracula,
144144
},
145145
} satisfies Preset.ThemeConfig,
146+
themes: [
147+
// ... Your other themes.
148+
[
149+
require.resolve("@easyops-cn/docusaurus-search-local"),
150+
/** @type {import("@easyops-cn/docusaurus-search-local").PluginOptions} */
151+
({
152+
// ... Your options.
153+
// `hashed` is recommended as long-term-cache of index file is possible.
154+
hashed: true,
155+
156+
// For Docs using Chinese, it is recomended to set:
157+
language: ["en", "zh"],
158+
159+
// If you're using `noIndex: true`, set `forceIgnoreNoIndex` to enable local index:
160+
// forceIgnoreNoIndex: true,
161+
}),
162+
],
163+
],
146164
};
147165

148166
export default config;

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"dependencies": {
1818
"@docusaurus/core": "3.8.1",
1919
"@docusaurus/preset-classic": "3.8.1",
20+
"@easyops-cn/docusaurus-search-local": "^0.51.1",
2021
"@mdx-js/react": "^3.0.0",
2122
"clsx": "^2.0.0",
2223
"prism-react-renderer": "^2.3.0",

0 commit comments

Comments
 (0)