-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Document Search #534
Add Document Search #534
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a pretty cool feature @sloshy and the result is outstanding. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks great @sloshy, really cool addition to the plugin! 🙌
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 Thanks @sloshy !
Resolves #503 and #196.
Depends on #529 (please review that first)
Adds a basic search functionality, client-side and enabled by default, to sbt-microsites. Currently the search only provides links to documents, and not headings within each document. Doing that would require a bit more effort, and I believe this is a good stop-gap solution for search that at least gets our foot in the door.
How it works:
There is a search bar at the top of the home page and all document pages. Typing terms in the search (according to https://lunrjs.com/ rules) will generate a score, and use this to search relevant results. The user can press the up and down arrow keys to navigate the list, or ESC to close the drop-down.
Basic demo of search, nav, and ESC to close:
Screen.Recording.2021-01-25.at.6.47.58.PM.mov
The search index is generated client-side using the contents of each document in a special JS file. If search is disabled, this will never be generated and the resulting files are smaller.