chore: merge round 5 search fixes

This commit is contained in:
Abdessamad Derraz committed 2026-10-27 06:54:51 +01:00
commit fecc6d9d32
15 files changed
+642 -67

No files matched your search

+8 -3
View File
@@ -1,7 +1,8 @@
// What each page knows of its place in the site, computed once per page
// from what scripts/sitestarlight.py writes beside the sidebar:
// - breadcrumbs: the tab and the groups above the page, each linked to the
// page or the section that introduces it, never to a sibling page;
// page or the section that introduces it, never to a sibling page. A
// group of names by their first letter (A, B) is no crumb;
// - previous and next: the reading order of `reading`. Start here runs on
// into Your setup, every other tab is read on its own, and a system,
// emulator or platform page has none;
@@ -19,7 +20,7 @@ import sidebar from './generated/sidebar.json' with { type: 'json' };
type Entry = StarlightRouteData['sidebar'][number];
type Link = Extract<Entry, { type: 'link' }>;
type Group = { href: string | null; prune: boolean };
type Group = { href: string | null; prune: boolean; crumb?: boolean };
export type Crumb = { label: string; href?: string };
const BASE = import.meta.env.BASE_URL.replace(/\/?$/, '/');
@@ -55,7 +56,11 @@ const trail = (entries: Entry[], labels: string[]): Crumb[] | undefined => {
const here = [...labels, entry.label];
const below = trail(entry.entries, here);
if (below) {
const href = groupOf(here)?.href;
const group = groupOf(here);
// A group of names by their first letter is a way through the
// list, not a place: the crumb stops at the list.
if (group?.crumb === false) return below;
const href = group?.href;
return [{ label: entry.label, href: href ? withBase(href) : undefined }, ...below];
}
}
+2 -2
View File
@@ -784,11 +784,11 @@ const hashLookupRow = (drawer: HTMLElement, value: string) => {
// Pagefind lists a page's title twice: once for the page and once for the
// anchor of its h1 (#_top). The second title is hidden, its excerpt kept.
// The `files`, `aliases`, `devices`, `consoles` and `terms` fields weigh in
// The `files`, `aliases`, `devices`, `consoles`, `exact` and `terms` fields weigh in
// the ranking and are never shown: a result is not a list of 120 names. Pagefind reuses
// its nodes from one query to the next, so both are worked out again on
// every change.
const UNSHOWN_FIELDS = new Set(['files', 'aliases', 'devices', 'consoles', 'terms']);
const UNSHOWN_FIELDS = new Set(['files', 'aliases', 'devices', 'consoles', 'exact', 'terms']);
const tidyResults = (root: Element) => {
for (const title of root.querySelectorAll<HTMLElement>('.pagefind-ui__result-nested > .pagefind-ui__result-title')) {