Add search
In the docsite redesign we removed the duckduckgo search bar. The plan is to replace it with a custom search bar.
Current ideas for this are roughly
- use something like elasticlunr
- produce an index by scanning the generated _site, focussing the search on the
<main>,<title>, and<h*>tags with more weight on<h*>and<title> - it would be nice to recognise API functions and give them more weight so that it is possible to go to them quickly. Not sure how much work that would be.
- write js to present search results in a reasonably nice form (examples would be mdbook or the search on the tailwindcss.com site)
- make sure search can be operated by keyboard without mouse
The main problem is that you either have to load all pages (or an index) in one big blob, to have the full context, or you need a server side component like node.js or whatever, which won't work for a static site. This is definitely one of those things that seems easy, but is hard to get right.
Yes, the plan is to generate an index offline and load it separately (asynchronously) so that it is at least cached and not duplicated on each page. Unlikely to be quick and easy, I agree.
That wouldn't be too bad, loading only on demand with Javascript when people do an actual search. You could then also split up the index into multiple files. That should be doable and give decent results.