• Adding search to a static site with Lunr and Preact Feb 4, 2022

    Leveraging the templating capabilities and Javascript rendering capabilities of Hugo to generate a Lunr index, rendered with search as you type using Preact.

    The website you are reading this on is made up of a set of static assets rendered with Hugo. This post walks through adding a basic search feature to this site that runs locally in your browser. I wanted to build out search in a way that aligned with the current statically generated approach, avoiding any server-side logic and executing queries entirely within the browser. Additionally, I wanted to keep the build process for the site simple, so avoiding the addition of any special steps in the local development or production build processes. This post walks through how I accomplished it for this site and how you could do the same.