Ability to add custom values to PagefindUI
constructor options (in Search component)
#1358
Replies: 6 comments 4 replies
-
In the meantime the fix/hack has been deployed, so the issue is no longer reproducible. But the RFC is still valid imho :) |
Beta Was this translation helpful? Give feedback.
-
I think it would probably a good idea to extend build options to be consistent with pagefind ui links, we did something similar with the sidebar. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the post @webpro! I agree with @kevinzunigacuellar and I think we can split this in two parts:
|
Beta Was this translation helpful? Give feedback.
-
Thanks guys! ❤️ |
Beta Was this translation helpful? Give feedback.
-
Hi, access to pageFindUI options would be great to have, I need to remove stopwords from the search input before passing it to pageFindUI. It would be great if I can pass my own config or the |
Beta Was this translation helpful? Give feedback.
-
What version of
starlight
are you using?0.15.1
What is your idea?
The
<Search>
component uses thePagefindUI
constructor of thepagefind
dependency with a rather fixed set of options.In my case I'd like to add a processResults function to the options, because
pagefind
has a trailing slash in the url's of the page results, which results in 404s on my site.Perhaps it makes sense to offer a way to add/override any of the options passed to the
PagefindUI
constructor.Why is this feature necessary?
To reproduce the issue on this Starlight instance: go to https://knip.dev/v4 and search for e.g. "paths" and upon navigation the result will be a 404, caused by the trailing slash. This is not necessarily caused by Starlight, but rather how the server is configured/hosted and/or how url's are rewritten. I do have
trailingSlash: 'never'
set, but I understand by the nature of SSG theindex.html
is served from a url including a trailing slash by default.The issue is not there when searching from the "default" (i.e. not "/v4") part of the website, so the cause is likely on my end, in the Vercel rewrite configuration. I'd just like to hook into
PagefindUI
myself to pass aprocessResult
function and modify the url's to remove the trailing slash.An awesome community member opened a pull request with a rather hacky fix: https://github.com/webpro/knip/pull/447/files
Do you have examples of this feature in other projects?
No response
Participation
Beta Was this translation helpful? Give feedback.
All reactions