Skip to content

Pagefind

Pagefind builds a search index from finished site files and lets visitors search it in their browser.

Visit Pagefind

What can Pagefind actually find?

Pagefind reads the HTML files your site build creates. It writes a bundle of search files that you publish alongside those pages. The browser loads the pieces it needs and does the search, so you do not need a separate search service.

If a page only shows its content after it fetches data in the browser, that content is not in the built HTML for the default scan. Check the actual build folder before choosing what to index.

How do you keep navigation and private pages out?

Build the search index from files you intend to publish. Mark the main content area when you want Pagefind to focus on the article. You can label public pages by topic or section so readers can narrow results.

A topic filter only changes what results the browser shows. Keep account records and drafts out of both the public HTML and the published search files. Excluding an element from indexing can still leave its metadata or filter labels unless you exclude all processing.

How can you check the bundle before you publish it?

Use a throwaway folder with fictional HTML pages and run Pagefind’s local preview. Confirm the command points at that folder and serves only local test files. If you cannot verify the folder and command, inspect the built HTML and index configuration on paper.

  1. Create an expected match
    Put a distinctive phrase such as Cedar repair in a sample article. Put a second page with unrelated text in the same folder. Put a third sample with a different unique phrase outside the folder, where Pagefind will not read or serve it.
  2. Check both results and exclusions
    Search for Cedar repair in the local preview and open the result to confirm the link. Search for the excluded phrase and verify it yields no match. Verify the excluded file is outside the folder that will be published as well.
  3. Check a stale result
    Change Cedar repair to Birch repair, rebuild the index and serve the rebuilt bundle. Use a fresh browser session to check Birch appears and Cedar no longer returns the old page.

What do you publish and keep for the next build?

Pagefind is MIT-licensed. Its static workflow has no vendor request allowance. You still pay for the build and site hosting you use, and visitors download index files. Publish pages and the matching search bundle together. Keep the content, build configuration and topic labels so you can regenerate the bundle when you move hosts.