DocSearch component supports custom link for results footer component #2806
Replies: 2 comments 4 replies
-
cc: @KianNH, for viz |
Beta Was this translation helpful? Give feedback.
-
Hey @kodster28! Thanks for spinning up the discussion. This is a bit tricky due to exactly the same limitation Seb Lorber mentions in facebook/docusaurus#10737 (comment) — values in the We actually faced the same issue for Astro’s Docs and ended up not using the official Starlight + DocSearch plugin in favour of a custom component instead, but that’s definitely not ideal! How we usually work around this is having the config provide a path to the thing instead, for example it could look like: starlightDocSearch({
// credentials etc.
clientOptionsModule: './src/docsearch-options.ts',
}) With users than writing something like: // src/docsearch-options.ts
export default {
resultsFooterComponent({ state }) {
// ...
},
}; Internally we could then wire up importing those options via a virtual module so they worked. |
Beta Was this translation helpful? Give feedback.
-
What version of
starlight
are you using?0.29.3
What is your idea?
Expose an additional configuration options for the docsearch component that allows you to add in a custom link for the
props.href
piece of theresultsFooterComponent
.Maybe also for the
getMissingResultsUrl
... but that might be harder, at least evidenced by facebook/docusaurus#10737Why is this feature necessary?
When you have a large set of docs (like Cloudflare), sometimes the on-page search for Algolia isn't the most helpful.
You search for something and -- upon getting too many results back -- need to get offloaded to a full search engine results page to filter through all the various docs.
As long as that was surfaced where we could specify the path, would be totally fine if the limit to customization was
/userpath/?q=<...>
.Bit of color in facebook/docusaurus#10737 as well
Do you have examples of this feature in other projects?
Participation
Beta Was this translation helpful? Give feedback.
All reactions