Full-Text Search using Hugo & Lunr
Adding full-text search to a statically generated Hugo site is a fairly easy process. As I’ve mentioned before, I’m already using Gulp to compile and minify my site. Using that Gulp file as my starting point, adding full-text search is a simple three-part process.
To enable search, I decided to use the Lunr.js library. Lunr is simple to use and has just the right amount of features for adding some simple search capabilities to your site. To start, you’ll need to create a JSON index of your site for Lunr to use. I put this layout under _default and called it search.json.