matcornic / hugo-theme-learn

Porting Grav Learn theme to Hugo
https://learn.netlify.com/en/
MIT License
1.6k stars 1.28k forks source link

Search function not working as expected #539

Open RolfLund opened 2 years ago

RolfLund commented 2 years ago

Hey there.

Thank you for an awesome theme - I have used the learn-theme a lot and it is great!

I have had some trouble getting the search function to work as intended. By adding:

[outputs]
home = [ "HTML", "RSS", "JSON"]

And it kinda does the job. It searches text in menus that are already open but if the menu is closed, it is unable to search within. Perhaps this is intended functionality, but it would be massively helpful if it could search collapsed menus as well.

I am using Hugo v.0.90.1 and have tested with Brave, Chrome and Firefox.

McShelby commented 2 years ago

It's bit unclear from the description what you want to achieve.

I assume: If you open the homepage at learn.netlify.app and search for "Requirements" you want to open the "Basics" menu and mark the "Requirements" menu point?

That's currently not possible with this theme and I doubt it will got implemented as this theme is dead. Technically this would require collapsible menus which also isn't a feature of this theme althought it was long requested (#511, #414, #88)

I've implemented a feature into the Relearn fork that opens expand-shortcodes if a search term is found in there.

The same mechanism may also be used to also open collapsed menus