Gathering detailed insights and metrics for docusaurus-plugin-search-local
Gathering detailed insights and metrics for docusaurus-plugin-search-local
Gathering detailed insights and metrics for docusaurus-plugin-search-local
Gathering detailed insights and metrics for docusaurus-plugin-search-local
docusaurus-lunr-search
Offline search component for Docusaurus V3
@cmfcmf/docusaurus-search-local
Local / Offline Search for Docusaurus
@easyops-cn/docusaurus-search-local
An offline/local search plugin for Docusaurus v3
@docusaurus/theme-search-algolia
Algolia search component for Docusaurus.
An offline/local search plugin for Docusaurus v2
npm install docusaurus-plugin-search-local
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
25 Stars
210 Commits
9 Forks
3 Watching
10 Branches
6 Contributors
Updated on 27 Nov 2024
TypeScript (90.07%)
CSS (5.65%)
JavaScript (4%)
MDX (0.27%)
Cumulative downloads
Total Downloads
Last day
59.3%
43
Compared to previous day
Last week
-9.2%
208
Compared to previous week
Last month
25%
1,269
Compared to previous month
Last year
-9.7%
27,688
Compared to previous year
9
44
An offline/local search plugin for Docusaurus v2, which supports multiple languages.
Originally forked from cmfcmf/docusaurus-search-local.
Then later fully rewritten with TypeScript 💪, styles polished 💅, and tests covered ✅.
https://gabrielcsapo.github.io/docusaurus-plugin-search-local/
1npm install --save docusaurus-plugin-search-local 2# or 3yarn add docusaurus-plugin-search-local
Add docusaurus-plugin-search-local
into your docusaurus plugins.
1// In your `docusaurus.config.js`: 2module.exports = { 3 // ... Your other configurations. 4 plugins: [ 5 // ... Your other plugins. 6 [ 7 require.resolve('docusaurus-plugin-search-local'), 8 { 9 // ... Your options. 10 // `hashed` is recommended as long-term-cache of index file is possible. 11 hashed: true, 12 // ``` 13 // language: ["en", "de"], 14 // ``` 15 }, 16 ], 17 ], 18};
Name | Type | Default | Description |
---|---|---|---|
indexDocs | boolean | true | Whether to index docs. |
indexBlog | boolean | true | Whether to index blog. |
indexPages | boolean | false | Whether to index pages. |
docsRouteBasePath | string | string[] | "/docs" | Base route path(s) of docs. Slash at beginning is not required. |
blogRouteBasePath | string | string[] | "/blog" | Base route path(s) of blog. Slash at beginning is not required. |
language | string | string[] | "en" | All lunr-languages supported languages. |
hashed | boolean | false | Whether to add a hashed query when fetching index (based on the content hash of all indexed *.md in docsDir and blogDir if applicable) |
docsDir | string | string[] | "docs" | The dir(s) of docs to get the content hash, it's relative to the dir of your project. |
blogDir | string | string[] | "blog" | Just like the docsDir but applied to blog. |
removeDefaultStopWordFilter | boolean | false | Sometimes people (E.g., us) want to keep the English stop words as indexed, since they maybe are relevant in programming docs. |
highlightSearchTermsOnTargetPage | boolean | false | Highlight search terms on target page. |
searchResultLimits | number | 8 | Limit the search results. |
searchResultContextMaxLength | number | 50 | Set the max length of characters of each search result to show. |
translations | TranslationMap | - | Set translations of this plugin, see docs below. |
ignoreFiles | string | RegExp | (string | RegExp)[] | /meta$/ | Set the match rules to ignore some files. |
To make this plugin localized, pass a translations
option which defaults to:
1{ 2 "search_placeholder": "Search", 3 "see_all_results": "See all results", 4 "no_results": "No results.", 5 "search_results_for": "Search results for \"{{ keyword }}\"", 6 "search_the_documentation": "Search the documentation", 7 "count_documents_found": "{{ count }} document found", 8 "count_documents_found_plural": "{{ count }} documents found", 9 "no_documents_were_found": "No documents were found" 10}
Note that *_plural
can be omitted if it is the same as singular.
This plugin is shipped with polished styles just like the Algolia Search on the Docusaurus v2 website. Feel free to override these css custom properties (css variables) below.
Var | Default (light) | Default (dark) |
---|---|---|
--search-local-modal-background | #f5f6f7 | var(--ifm-background-color) |
--search-local-modal-shadow | inset 1px 1px 0 0 hsla(0, 0%, 100%, 0.5), 0 3px 8px 0 #555a64 | inset 1px 1px 0 0 #2c2e40, 0 3px 8px 0 #000309 |
--search-local-modal-width | 560px | - |
--search-local-modal-width-sm | 340px | - |
--search-local-spacing | 12px | - |
--search-local-hit-background | #fff | var(--ifm-color-emphasis-100) |
--search-local-hit-shadow | 0 1px 3px 0 #d4d9e1 | none |
--search-local-hit-color | #444950 | var(--ifm-font-color-base) |
--search-local-hit-height | 56px | - |
--search-local-highlight-color | var(--ifm-color-primary) | - |
--search-local-muted-color | #969faf | var(--ifm-color-secondary-darkest) |
--search-local-icon-stroke-width | 1.4 | - |
--search-local-hit-active-color | var(--ifm-color-white) | - |
E.g.:
1:root { 2 --search-local-modal-width: 480px; 3 --search-local-highlight-color: #5468ff; 4} 5 6html[data-theme='dark'] { 7 --search-local-highlight-color: #d23669; 8}
When building your docs project, Set the env DEBUG=docusaurus-plugin-search-local:*
to enable debug logs.
1# In your docs project: 2DEBUG=docusaurus-plugin-search-local:* yarn build
See contributing guide.
No vulnerabilities found.
No security vulnerabilities found.