shishkin / astro-pagefind

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

Add option for stripping trailing slashes from search result links #95

Open paulrudy opened 1 month ago

paulrudy commented 1 month ago

Referencing the discussion from #94: Some users may prefer to have trailing slashes stripped from search result links to match their preferred route formatting in Astro.

Pagefind has a processResult UI config option that accepts a function for rewriting search results before rendering them. But since the props to this integration's Search component are JSON-serialized, this function can't be passed.

This PR adds an optional stripTrailingSlash prop for the Search component. If "true", trailing slashes in the search results are stripped.

It also adds that option to the example Main.layout.