File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -45,6 +45,9 @@ export default defineConfig({
4545 components : {
4646 // Override the default `Head` component to add our page tracking.
4747 Head : './src/components/starlight/Head.astro' ,
48+ // Boost schema reference pages in Pagefind results.
49+ MarkdownContent : './src/components/starlight/MarkdownContent.astro' ,
50+ PageTitle : './src/components/starlight/PageTitle.astro' ,
4851 // Override the default `SiteTitle` component to link to both firegiant.com and docs.firegiant.com.
4952 SiteTitle : './src/components/starlight/SiteTitle.astro' ,
5053 } ,
Original file line number Diff line number Diff line change 1+ ---
2+ import ' @astrojs/starlight/style/markdown.css' ;
3+ import { PRIORITY_PAGEFIND_CONTENT_WEIGHT , isPrioritySearchSlug } from ' ../../utils/pagefind' ;
4+
5+ const slug = Astro .locals .starlightRoute .entry .slug ;
6+ const dataAttributes = isPrioritySearchSlug (slug )
7+ ? { ' data-pagefind-weight' : PRIORITY_PAGEFIND_CONTENT_WEIGHT }
8+ : {};
9+ ---
10+
11+ <div class =" sl-markdown-content" {... dataAttributes }><slot /></div >
Original file line number Diff line number Diff line change 1+ ---
2+ import { PRIORITY_PAGEFIND_TITLE_WEIGHT , isPrioritySearchSlug } from ' ../../utils/pagefind' ;
3+
4+ const PAGE_TITLE_ID = ' _top' ;
5+ const slug = Astro .locals .starlightRoute .entry .slug ;
6+ const dataAttributes = isPrioritySearchSlug (slug )
7+ ? { ' data-pagefind-weight' : PRIORITY_PAGEFIND_TITLE_WEIGHT }
8+ : {};
9+ ---
10+
11+ <h1 id ={ PAGE_TITLE_ID } {... dataAttributes }>{ Astro .locals .starlightRoute .entry .data .title } </h1 >
12+
13+ <style >
14+ @layer starlight.core {
15+ h1 {
16+ margin-top: 1rem;
17+ font-size: var(--sl-text-h1);
18+ line-height: var(--sl-line-height-headings);
19+ font-weight: 600;
20+ color: var(--sl-color-white);
21+ }
22+ }
23+ </style >
Original file line number Diff line number Diff line change 1+ const PRIORITY_SEARCH_PREFIXES = [ 'wix/schema/' , 'firegiant/schema/' ] as const ;
2+
3+ export const PRIORITY_PAGEFIND_CONTENT_WEIGHT = '8' ;
4+ export const PRIORITY_PAGEFIND_TITLE_WEIGHT = '10' ;
5+
6+ export function isPrioritySearchSlug ( slug : string ) : boolean {
7+ return PRIORITY_SEARCH_PREFIXES . some ( ( prefix ) => slug . startsWith ( prefix ) ) ;
8+ }
You can’t perform that action at this time.
0 commit comments