Pagefind is a Python API wrapper for the Pagefind Rust binary, providing static, low-bandwidth full-text search capabilities for websites. It excels at indexing large static sites, supporting HTML files, custom records, and multilingual content. The library is actively maintained, with version 1.5.0 released on April 6, 2026, offering an asynchronous interface for programmatic indexing.
pip install 'pagefind[bin]'Verified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize Pagefind, add HTML content directly, and include custom records in the search index using its asynchronous Python API. The output index files will be saved to `./pagefind_output`.
Update your build process or configuration to expect `pagefind` as the output directory, or explicitly set `output_path` in `IndexConfig`.
Adjust any direct CLI calls or subprocess commands to use the new option names (`--site`, `--output-subdir`).
Always use `pip install 'pagefind[bin]'` or `pip install 'pagefind[extended]'` unless you intend to provide the Pagefind binary yourself.
Wrap `PagefindIndex` instantiation and usage within an `async with PagefindIndex(...) as index:` block.
Be aware that search result order may differ. Ranking parameters can be configured via `IndexConfig` if fine-tuning is required.
Install the package using pip: `python3 -m pip install 'pagefind[extended]'` or `python3 -m pip install 'pagefind[bin]'`.
If installed via the Python package, run it using `python3 -m pagefind --site public`. If installed via npm, use `npx pagefind --site public`. If manually downloaded, ensure the binary's directory is in your system's PATH.
Import the `PagefindIndex` class from `pagefind.index` and then instantiate it: `from pagefind.index import PagefindIndex` followed by `indexer = PagefindIndex()`.