gerwitz / hgc-v12

The twelfth version of my website, built with Eleventy
https://hans.gerwitz.com
7 stars 1 forks source link

Full-text search with Lunr and 11ty, just general questions #18

Closed mattdsteele closed 4 years ago

mattdsteele commented 4 years ago

Hi! I'm interested in building out a little JAMstack app for a side project (a recipe cookbook). I'm looking to build it with Eleventy, and incorporate client-side full-text search.

I'm not very familiar with search libraries, but Lunr looks like a great option from a cursory search, so when I saw https://github.com/11ty/eleventy/issues/522 I thought I'd pick your brain :)

Perusing your code it looks like you're generating the index via https://github.com/gerwitz/hgc-v12/blob/master/src/search/lunr.json.11ty.js and deploying it via https://hans.gerwitz.com/search/lunr.json

So I'm curious, generally did you like this stack? Are there any gotchas I should be aware of before I start down this path, or Lunr resource you found particularly helpful?

Thanks!

gerwitz commented 4 years ago

You have discerned correctly. FWIW, I was previously doing this with Middleman so all the “runtime” code is pretty old.

Here with Eleventy, I’m using a custom collection (cryptically named “content”) in that index builder, but there’s no reason to emulate that if your SSG of choice thinks differently.

I’m pretty happy with it, but figuring it out was a pain. So I hope to write it up for others, but don’t wait for me to just copy!

On Nov 19, 2019, at 02:49, Matt Steele notifications@github.com wrote:

 Hi! I'm interested in building out a little JAMstack app for a side project (a recipe cookbook). I'm looking to build it with Eleventy, and incorporate client-side full-text search.

I'm not very familiar with search libraries, but Lunr looks like a great option from a cursory search, so when I saw 11ty/eleventy#522 I thought I'd pick your brain :)

Perusing your code it looks like you're generating the index via https://github.com/gerwitz/hgc-v12/blob/master/src/search/lunr.json.11ty.js and deploying it via https://hans.gerwitz.com/search/lunr.json

So I'm curious, generally did you like this stack? Are there any gotchas I should be aware of before I start down this path, or Lunr resource you found particularly helpful?

Thanks!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

mattdsteele commented 4 years ago

Very cool! I think between this and the search just added into 11ty.io I have enough to cargo-cult :)

Thanks!