Search
How Pagefind indexing works and how to control what is searchable.
On this page
Search is static. There is no service to sign up for, no index to keep in sync and no request that leaves the reader's browser except for the index files themselves.
The pipeline
Markdown → Hugo → static HTML → Pagefind index → search UIPagefind runs after Hugo, crawls public/, and writes a fragmented index into
public/pagefind/. The browser downloads only the fragments a query touches, so
the cost of search does not grow with the size of your documentation.
What gets indexed
Only the element marked data-pagefind-body — the page heading, description and
body content. Navigation, breadcrumb, table of contents and the previous/next links
are outside it, so they never pollute results.
To exclude part of a page, mark it in your Markdown:
<div data-pagefind-ignore>
This block is rendered but never indexed.
</div>To exclude a whole page, add it to the front matter of that page:
---
title: Internal notes
build:
list: never
---The palette
| Key | Action |
|---|---|
| ⌘K / CtrlK | Open search |
| / | Open search when not typing |
| ↑ ↓ | Move between results |
| Enter | Open the selected result |
| Esc | Close |
The dialog is a native <dialog> element, so focus trapping, the inert background
and Esc come from the browser rather than from JavaScript.
Configuration
[params.search]
enable = true
placeholder = "Search documentation..."
maxResults = 12Under pnpm dev the index does not exist yet and the palette says so. Run
pnpm preview to build the index and browse the production output locally.