Fixedsearch - a fast, client side search for Hugo with Fusejs

This is a client side drop-in for searching text on Hugo sites:

See heracl.es for a live preview: hit Ctrl + / or click on the magnifying glass icon and start typing. With its default styling, fixedsearch appears as a magnifying glass ( ⌕ ) at the top right of your pages. When in focus, a fixed interface appears at the right.

  • Press Ctrl + / to invoke search or click on the magnifying glass icon.
  • Start typing and see results as you type.
  • Use Enter once, or Tab or arrow keys to select result.
  • Press Enter to navigate to the selected page.
  • You may exit the search interface with the Esc key, or taking focus away from it.
  • You may return from the results to the search box with the Backspace key.

It’s by no means a novel implementation (see fuse #tips-tricks), but an alternate take with focus on keyboard shortcuts and avoiding to load the search mechanism and index until needed. Builds upon the work of Craig Mod’s fastSearch, Eddie Webb’s search and Matthew Daly’s search explorations. I hope it becomes useful to Hugo makers, as the work it’s based on was to me.

10 Likes