shishkin / astro-pagefind

Astro integration for Pagefind static site search.
MIT License
266 stars 15 forks source link

Is there a way to define pagefind config? #87

Open kolyasya opened 3 months ago

kolyasya commented 3 months ago

Hey, thanks for a great package.

I wonder if there is a way to define config options for pagefind, because I want to adjust index for my app.

Looks like it receives an empty options object here: https://github.com/shishkin/astro-pagefind/blob/main/packages/astro-pagefind/src/pagefind.ts#L58

Btw, I see that it is implemented in another integration https://github.com/itsmatteomanf/astro-components/blob/main/packages/astro-pagefind/src/integration.ts#L38

shishkin commented 3 months ago

Thanks. It's totally doable. I just never had a use case for that and wonder which options would make send to pass through. I definitely would like to avoid complicating the integration and face possible inconsistencies later. Looking through the createIndex args it seems at least harmless to pass them through. So what is your use case for overriding those options?

kolyasya commented 3 months ago

@shishkin I was just trying to index only headings and figured out what I can to that with data-xxxxx tags according to pagefind docs.

But anyway for me it looks like in any library which is written over another one there is always a way to pass params like: pagefindOptions: { ... } and everything just goes through.

I see that the package I mentioned has a validation for these params which is nice, but not critical. It is the user's responsibility to check the docs and pass the correct params :-)