Skip to content

Commit e41e020

Browse files
ZneekyChronosSF
andauthored
feat(search): exclude code from the Pagefind index (#306)
Register the rehype-pagefind-ignore plugin from igniteui-astro-components in the rehype pipeline. It marks code blocks and single character inline code with data-pagefind-ignore so Pagefind stops indexing their one letter tokens, which were producing weak, irrelevant prefix matches (for example a search for "twitter" matching the "t" in "keyof T" across unrelated API pages). Co-authored-by: Stamen Stoychev <sstoychev@infragistics.com>
1 parent 424ef89 commit e41e020

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/integration.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ import { remarkMdLinks } from './plugins/remark-md-links';
6464
import { remarkHtmlTransforms } from './plugins/remark-html-transforms';
6565
import { rehypeTableWrapper } from 'igniteui-astro-components/plugins/rehype-table-wrapper';
6666
import { rehypeHeadingAnchors } from 'igniteui-astro-components/plugins/rehype-heading-anchors';
67+
import { rehypePagefindIgnore } from 'igniteui-astro-components/plugins/rehype-pagefind-ignore';
6768
import { rehypeStripEmptyParagraphs } from './plugins/rehype-strip-empty-paragraphs';
6869
import { rehypeApiReferencesGrid } from './plugins/rehype-api-references-grid';
6970

@@ -614,6 +615,7 @@ export function createDocsSite(options: CreateDocsSiteOptions = {} as CreateDocs
614615
rehypeHeadingAnchors,
615616
rehypeStripEmptyParagraphs,
616617
rehypeApiReferencesGrid,
618+
rehypePagefindIgnore,
617619
...((astroExtra as any).markdown?.rehypePlugins ?? []),
618620
],
619621
},

0 commit comments

Comments
 (0)