Skip to content

Commit 0fa3f19

Browse files
committed
install search
1 parent d1facd1 commit 0fa3f19

3 files changed

Lines changed: 442 additions & 3 deletions

File tree

docusaurus.config.ts

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ const config: Config = {
142142
routeBasePath: '',
143143
},
144144
theme: {
145-
customCss: require.resolve('./src/css/custom.css'),
145+
customCss: ['./src/css/custom.css', './src/css/local-search.css'],
146146
},
147147
} satisfies Preset.Options,
148148
],
@@ -173,6 +173,40 @@ const config: Config = {
173173
color: '#5bbad5',
174174
},
175175
],
176+
plugins: [
177+
[
178+
'@cmfcmf/docusaurus-search-local',
179+
{
180+
indexDocs: true,
181+
indexDocSidebarParentCategories: 0,
182+
includeParentCategoriesInPageTitle: false,
183+
// whether to index blog pages
184+
indexBlog: true,
185+
186+
// whether to index static pages
187+
// /404.html is never indexed
188+
indexPages: false,
189+
190+
// language of your documentation, see next section
191+
language: 'en',
192+
193+
// setting this to "none" will prevent the default CSS to be included. The default CSS
194+
// comes from autocomplete-theme-classic, which you can read more about here:
195+
// https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-theme-classic/
196+
// When you want to overwrite CSS variables defined by the default theme, make sure to suffix your
197+
// overwrites with `!important`, because they might otherwise not be applied as expected. See the
198+
// following comment for more information: https://github.com/cmfcmf/docusaurus-search-local/issues/107#issuecomment-1119831938.
199+
maxSearchResults: 10,
200+
lunr: {
201+
tokenizerSeparator: /[\s\-]+/,
202+
titleBoost: 5,
203+
contentBoost: 1,
204+
tagsBoost: 3,
205+
parentCategoriesBoost: 2, // Only used when indexDocSidebarParentCategories > 0
206+
},
207+
},
208+
],
209+
],
176210
markdown: {
177211
// https://docusaurus.io/docs/migration/v3#using-the-mdx-extension
178212
mdx1Compat: {

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"upgrade": "yarn set version latest && yarn up @docusaurus/core@latest @docusaurus/plugin-client-redirects@latest @docusaurus/preset-classic@latest @docusaurus/theme-mermaid@latest @docusaurus/theme-search-algolia@latest @docusaurus/module-type-aliases@latest @docusaurus/tsconfig@latest @docusaurus/types@latest"
1414
},
1515
"dependencies": {
16+
"@cmfcmf/docusaurus-search-local": "^2.0.1",
1617
"@docusaurus/core": "^3.9.2",
1718
"@docusaurus/plugin-client-redirects": "^3.9.2",
1819
"@docusaurus/preset-classic": "^3.9.2",

0 commit comments

Comments
 (0)