Conversation
|
✅ Deploy Preview for astro-starlight ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
delucis
left a comment
There was a problem hiding this comment.
Oh yeah, I see the issues with this like you mentioned: the excerpt is not clickable and not clearly associated with the page title as one might expect.
I wonder if we can improve on that styling.
An additional thought: if the most common cause of this is our own banner component — we should maybe consider ignoring that by default? Don’t think it’s expected for that to appear in search results.
|
Couple of quick experiments:
The weird thing about this approach is that the excerpt is still not actually hoverable to click the link over the excerpt — only on the title. Not sure if there’s a reliable way to extend the interactive area down over the excerpt without hard coding the height. Anchor positioning might help? But it doesn’t have broad support yet. |
|
Chatted with @HiDeoo and we’re closing this in favour of our project rewriting the search UI from scratch which he is currently working on. Any solution we try here will likely feel hacky and not fully work. #3276 should reduce the risk of users hitting this, so also reduces the urgency of a hacky fix like this. |





Description
In Pagefind, when searching the indexed content section, if a result is found before the first heading, an extra excerpt is shown below the page title.
At the moment, we do not style this excerpt at all in Starlight altho it can appear under some conditions, e.g. having a banner with content that is a potential match, and as we render
<Banner>in<main>(ourdata-pagefind-body), before the<PageTitle>, it'll be detected as root sub result and the excerpt will be shown.This PR adds some basic styling to the root excerpt so that it is visually consistent with the rest of the search results altho I'm personally not really happy with the result, as it kinda looks like a result rather than just an excerpt for a root result? I'm definitely not the best person when it comes to design, but I think we may be able to improve it further? A difference from nested results is that the title/link and excerpt are not grouped together with a parent element, they're just siblings in the entire page results.
This PR includes a temporary route data middleware adding a banner to every page so searching something like
testwill show the root excerpt.Remaining tasks