cmfcmf / docusaurus-search-local

Offline / Local Search for Docusaurus v2. Try it live at:
https://cmfcmf.github.io/OpenWeatherMap-PHP-API/
MIT License
437 stars 67 forks source link

How to show page title in search results? #134

Closed rethab closed 1 year ago

rethab commented 2 years ago

Hi, when searching e.g. api on your sample page, it shows "Getting Started" below "Installation":

image

I think this would be very helpful for terms that exist on various pages. Based on what does the plugin decide to show the page name? Is there a way to make this plugin always show the page?

Perhaps the above is a poor example, as the first few results seem to be page titles, which means showing the page title would be redundant. However, in my sample docusaurus installation (which I can't show unfortunately), I have e.g. the term "Crypto" on various pages as a subtitle ## Crypto. If I then search for "Crypto" it shows "Crypto" as a result without additional context on which page it was found.

stephendpmurphy commented 1 year ago

I second this! Something to give the searcher more context into each "result" would be great.

tiltos commented 1 year ago

This looks like it's a core feature. How can we go about turning it on? image

stephendpmurphy commented 1 year ago

@tiltos I was hoping to find some config on their Github but there's nothing beyond adding the plugin in the docusaurus config. They are using an older version (0.9.3) so maybe it was a feature that was enabled and then turned off in later versions?

stephendpmurphy commented 1 year ago

@rethab @tiltos Ah, after further testing it only appears to work if you place custom config and build out the sidebar manually. The feature doesn't appear to work if you use the auto-generated sidebar.

cmfcmf commented 1 year ago

Sorry for the long delay! This was broken for a bit, but should be fixed in the next version (see https://github.com/cmfcmf/docusaurus-search-local/issues/146).