CloudCannon / pagefind

Static low-bandwidth search at scale
https://pagefind.app
MIT License
3.22k stars 97 forks source link

Allow to override default weight of HTML elements in config #636

Open SebouChu opened 2 weeks ago

SebouChu commented 2 weeks ago

I would like the possibility to set custom weight values for elements. Is it possible to add something like this in config instead of using the data-pagefind-weight attribute.

Maybe something like :

autoWeights:
  h1: 10
  h2: 9
  p: 1
  ...
bglw commented 1 week ago

Good idea! I'm overdue to rework the configuration internally to allow richer config files (currently it unifies the config file and the CLI arguments, which is blocking complex config structures).

I recently landed a similar config pattern in Flatlake, so once I bring that code back over to Pagefind I can address this (and features like multiple globs) 🙂