Ability to adjust pagefind search result weighting on a page level #2348
lorenzolewis
started this conversation in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What version of
starlight
are you using?0.28.1
What is your idea?
Right now the only customization we have for Pagefind results is to include or exclude a page from search results (https://starlight.astro.build/guides/site-search/#exclude-a-page).
Additionally, you can directly modify the ranking of a specific part of a page using Pagefind's ranking mechanism: https://pagefind.app/docs/weighting/. However, this can be a bit awkward when doing inside of markdown files.
Right now there is no way to change the overall weight or ranking of a single page in the context of the returned search results within going into component overrides or hard-coding some HTML within your markdown files.
We could extend the
pagefind
front matter like this:The rank can be any number between 0.0 and 10.0 based on the Pagefind docs (bottom of page): https://pagefind.app/docs/weighting/#ranking-content-higher-or-lower.
We could keep current behavior of
pagefind: boolean
in the front matter to prevent breaking changes by using a union for the Zod schema.Why is this feature necessary?
With large sites there may be specific pages you wish to rank higher than others (such as an introduction or overview page for a given concept before a page that contains error messages for that concept).
Do you have examples of this feature in other projects?
Algolia custom ranking: https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/how-to/configure-custom-ranking/
Participation
Beta Was this translation helpful? Give feedback.
All reactions