pagefindPlugin
Indexes the built pages with Pagefind and writes the search bundle to pagefind/ in the output. The header part holds the search trigger, Ctrl+K or Cmd+K opens it, and the UI loads on first use.
theme.pagefindPlugin({ glob: "**/*.html" });Options
| Option | Type | Default | Role |
|---|---|---|---|
glob | string | "**/*.html" | Pages to index, relative to the output directory. |
What gets indexed
Only the content inside an element with data-pagefind-body, the layout puts it on <main>. Pagefind’s other attributes work as usual:
<nav data-pagefind-ignore>...</nav><h1 data-pagefind-meta="title">...</h1>Examples
Index the documentation only, not the landing page or showcases:
theme.pagefindPlugin({ glob: "contents/**/*.html" });Notes
- Production only, the dev server has no index and the trigger does nothing.
- The bundle is loaded relative to the page, so the site works on a subpath.
analyzeOutputPlugin({ deleteUnused: true })must excludepagefind/**.