Adding Search to a Hugo Site With Match Sorter

I'm adding search to the garden. I was originally going to make a call to either DuckDuckGo or Google. I didn't like the Google option because I'm moving away from their tracking on my site. DuckDuckGo has privacy going for it, but it would mean the search results page would kick over to their site. Bleck.

It's TypeScript and designed as an npm module. Hugo deals with neither. So, we took a hacksaw and blowtorch to it and turned it this plain-old, vanilla javascript:

Include that file, then use it like this.

NOTE: This code has been pulled out so it'll work the MDX.

TODO: Figure out how to get this code working with MDX.

The client side part kinda freaks me out. Like, you have to load all the content in that you want to search. I've got a thousand or so posts here. That's a lot of content. So, I'm still nervous about it, but given how huge most websites are these days, I guess it won't be out of the norm. That said, I'm still going to setup so the content is lazy loaded.

Hmmm, also makes me wonder about localstorage, like, could I store all the site content in there?