Giter Site home page Giter Site logo

alanwguo / docusaurus-lunr-search Goto Github PK

View Code? Open in Web Editor NEW

This project forked from praveenn77/docusaurus-lunr-search

0.0 0.0 0.0 251 KB

Local / Offline Search for docusaurus

Home Page: https://lelouch77.github.io/docusaurus-lunr-search-multilang/

License: MIT License

JavaScript 71.19% CSS 28.81%

docusaurus-lunr-search's Introduction

Similar Plugin https://github.com/easyops-cn/docusaurus-search-local

docusaurus-lunr-search

Offline Search for Docusaurus V2

Demo Website

MIT Licence

npm version

Sample

Prerequisites

worker_thread is needed, suggested node version > 12.X For older version of node use docusaurus-lunr-search version 2.1.0 (npm i [email protected])

How to Use ?

  1. Install this package
npm i docusaurus-lunr-search  --save
  1. Then run npm install to update, build, and link the packages
npm install
  1. Then run docusaurus swizzle
npm run swizzle docusaurus-lunr-search SearchBar -- --danger
  1. Add the docusaurus-lunr-search plugin to your docusaurus.config.js
module.exports = {
  // ...
    plugins: [require.resolve('docusaurus-lunr-search')],
}
  1. Then build your Docusaurus project
npm run build
  1. Serve your application
npx http-server ./build

Note: Docusaurus search information can only be generated from a production build. Local development is currently not supported.

Language options

module.exports = {
  // ...
    plugins: [[ require.resolve('docusaurus-lunr-search'), {
      languages: ['en', 'de'] // language codes
    }]],
}

Supports all the language listed here https://github.com/MihaiValentin/lunr-languages

Other options

excludeRoutes

You can exclude certain routes from the search by using this option:

module.exports = {
  // ...
    plugins: [
    [require.resolve('docusaurus-lunr-search'), {
        excludeRoutes: [
            'docs/changelogs/**/*', // exclude changelogs from indexing
        ]
    }]
  ],
}

indexBaseUrl

Base url will not indexed by default, if you want to index the base url set this option to true

module.exports = {
  // ...
    plugins: [
        [require.resolve('docusaurus-lunr-search'),
            {
                indexBaseUrl: true
            }
        ]
    ],
}

Thanks to algolia/docsearch.js, I modified it to create this search component

And thanks cmfcmf, I used the code from his library docusaurus-search-local for multi-language support.

Changelog

Checkout the releases page for changelog.

docusaurus-lunr-search's People

Contributors

1natsu172 avatar alanwguo avatar anru avatar davidiam avatar dependabot[bot] avatar divyabhushan avatar ipavlic avatar jknoxville avatar lelouch77 avatar rileyabr avatar shaneog avatar xf- avatar zachjw34 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.