I have spent most of the day trying to implement some form of hopefully static search. I tried two different methods listed here, one for lunr.js, one for fuse.js:
I could get neither to work. This was one: Hugo JS Searching with Fuse.js · GitHub
I can’t find the one I tried using lunr.js - any way. I searched the forums and found a thread with this very helpful post from @mwalters
Kinda new here and I know this discussion is a few months old, but thought I’d mention I recently went through setting this up on my site. I wrote up walk-through here: https://www.mattwalters.net/posts/hugo-and-lunr/ (I have very little on my site but you’ll get search results if you search for things like “hugo” or “spacex”)
After reading over this discussion I might should make a few changes to my setup (particularly the parts talking about using alternate output formats)
My implementatio…
After several false starts search is now functioning!
However, I have seen other posts on the forum indicating other methods, so I’m left wondering if this is still the optimal method?
I found fuse easier to set up for my small sites and since it works for CJK languages like Japanese with some settings tweaks, it is good for me.
You’ll see mention of Algolia, but, iirc the free version needs the site to be public.
2 Likes