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

Enable site-wide search #9

Closed
apreshill opened this issue Nov 11, 2020 · 5 comments
Closed

Enable site-wide search #9

apreshill opened this issue Nov 11, 2020 · 5 comments

Comments

@apreshill
Copy link
Contributor

apreshill commented Nov 11, 2020

Distill recently added this via fuse.js based on feature requests, and the new RStudio blog (a blogdown site built with a custom Hugo theme) will have it too via lunr.js.

This is very hard to add on your own, and is now a big differentiator for users to make the choice between Distill/bookdown and blogdown (one of the reasons I use the academic theme for teaching).

See:

https://github.com/rstudio/rstudio.com/pull/156/commits/026af8566fc1d3c3b6eee6d1a686f8551bec3b73

https://palant.info/2020/06/04/the-easier-way-to-use-lunr-search-with-hugo/

@jienagu
Copy link
Collaborator

jienagu commented Nov 13, 2020

Here is my two cents: https://github.com/bvaughn/js-search This is a client side light js search library.

@apreshill
Copy link
Contributor Author

That looks interesting- thank you for sharing! I cannot really evaluate relative dependencies, but fuse.js says also "Fuse.js is a powerful, lightweight fuzzy-search library, with zero dependencies" and "Simplicity and performance were the main criteria when developing this library." If we use fuse.js here, the search interface would be same across the new bs4_book bookdown output format and distill's website, which is nice for users to have a common interface and experience 🌟

@yihui
Copy link
Owner

yihui commented Nov 13, 2020

FYI I had figured out all pieces of information that I need yesterday (thanks to the super helpful notes by @apreshill), but I was interrupted later so didn't manage get it done. This is not technically challenging for me to implement now, but I do need some time (and also a good mood these days).

@yihui yihui closed this as completed in a5f32cf Nov 18, 2020
@yihui
Copy link
Owner

yihui commented Nov 18, 2020

Done. There may be a few rough edges but I think it's mostly working now: https://prose.yihui.org Click "Search" in the menu (it works on any page that has this menu), and type in the box to search. For an average site, it should be fairly fast. I tested with my own posts, too, and there was a delay of one or two seconds after typing, but I guess not many people have thousands of posts on their sites :)

@apreshill
Copy link
Contributor Author

Looks beautiful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants