CloudCannon / pagefind

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

Add a `processFilter()` setting to the PagefindUI #588

Open nhoizey opened 6 months ago

nhoizey commented 6 months ago

Programmatically controlling the Pagefind UI suggests that “a common use case [for triggerSearch and triggerFilters] is initializing the Pagefind UI based on query parameters”.

As we have a processTerm() setting allowing us to synchronize search terms typed by users to the URL:

processTerm: function (term) {
  history.replaceState({}, "", `?q=${encodeURIComponent(term)}`);
  return term;
},

It would be great if we had a processFilter() setting allowing us to also synchronize selected filters.