13vaults / 13vaults.com

An unofficial, community-driven resource for the 13th Age RPG.
https://www.13vaults.com
GNU Affero General Public License v3.0
9 stars 5 forks source link

Add site search functionality #22

Closed sean-clayton closed 3 months ago

sean-clayton commented 1 year ago

Two possible methods for the initial search:

  1. Just make a rudimentary offline search by collecting all the headings and titles of everything, associate URLs to those, and then do all the fuzzy searching on the client.
  2. Use Algolia's free tier. I don't think we'll exceed it anytime soon, and if we do, we probably would qualify for their open source discount
MisterCheesy commented 1 year ago

I need this.

sean-clayton commented 12 months ago

This Jekyll theme does offline search: https://just-the-docs.com

Under the hood is lunr.js: https://lunrjs.com

Should be able to build a json file during the build process. This should happen after contentlayer does its thing I think and piggyback off of that data.

Doing it on the server makes it possible to have a dedicated search page and server-rendered results without clogging up the client with a giant json file. Also makes it so JS isn't necessary to do a search if we use regular ol forms.