Skip to content
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

Merged
merged 7 commits into from
Jan 26, 2021
Merged

Add Document Search #534

merged 7 commits into from
Jan 26, 2021

Conversation

sloshy
Copy link
Contributor

@sloshy sloshy commented Jan 26, 2021

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.

@github-actions github-actions bot added the enhancement New feature or request label Jan 26, 2021
Copy link
Contributor

@rafaparadela rafaparadela left a 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.

Copy link
Contributor

@calvellido calvellido left a 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! 🙌

Copy link
Member

@juanpedromoreno juanpedromoreno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 Thanks @sloshy !

@sloshy sloshy merged commit 8d46000 into master Jan 26, 2021
@sloshy sloshy deleted the feature/doc-search branch January 26, 2021 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Request] Add a search plugin
4 participants