# astro-pagefind

> Astro integration for Pagefind static site search

Latest version **2.0.1** (published 2026-07-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install astro-pagefind
pnpm add astro-pagefind
yarn add astro-pagefind
bun add astro-pagefind
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; high maintenance score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2026-07-03 |
| First published | 2023-02-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 4.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 569 |
| Author | Sergey Shishkin |
| Maintainers | shishkin |
| Keywords | astro, astro-component, astro-integration, withastro, pagefind, search, ui |

## Links

- npm: https://www.npmjs.com/package/astro-pagefind
- Repository: https://github.com/shishkin/astro-pagefind
- Issues: https://github.com/shishkin/astro-pagefind/issues
- npm.io page: https://npm.io/package/astro-pagefind

## Dependencies (3)

- [sirv](https://npm.io/package/sirv.md) ^3.0.0
- [pagefind](https://npm.io/package/pagefind.md) ^1.5.0
- [@pagefind/component-ui](https://npm.io/package/@pagefind/component-ui.md) ^1.5.0

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 2.0.1 (latest) — 2026-07-03
- 2.0.0 — 2026-05-10
- 1.8.6 — 2026-03-25
- 1.8.5 — 2025-09-08
- 1.8.4 — 2025-08-28
- 1.8.3 — 2025-03-15
- 1.8.2 — 2025-03-11
- 1.8.1 — 2025-02-25
- 1.8.0 — 2025-01-24
- 1.7.0 — 2024-12-07
- 1.6.0 — 2024-07-21
- 1.5.0 — 2024-03-16
- 1.4.0 — 2024-01-09
- 1.3.0 — 2023-10-11
- 1.2.4 — 2023-09-14
- … 7 more at https://npm.io/package/astro-pagefind/versions

## README

# Astro-Pagefind

[![CI](https://github.com/shishkin/astro-pagefind/actions/workflows/ci.yaml/badge.svg)](https://github.com/shishkin/astro-pagefind/actions/workflows/ci.yaml)
[![npm](https://img.shields.io/npm/v/astro-pagefind)](https://www.npmjs.com/package/astro-pagefind)

[Astro](https://astro.build) integration for [Pagefind](https://pagefind.app/) static site search.

## Features

- Build pagefind index upon static build
- Serve previously prebuilt search index in `astro dev` mode
- Simple Search Astro component based on Pagefind Searchbox
- Supports customized base URL path
- Supports multiple instances of the component on a page
- Supports [Astro view transitions](https://docs.astro.build/en/guides/view-transitions)
- Allows [passing index config](packages/example/astro.config.ts) to pagefind

## Usage

Install:

```bash
npm i astro-pagefind
```

Add integration to the Astro config:

```typescript
//astro.config.ts

import { defineConfig } from "astro/config";
import pagefind from "astro-pagefind";

export default defineConfig({
  integrations: [pagefind()],
});
```

Add search component on a page:

```astro
---
import Search from "astro-pagefind/components/Search.astro";
---

<Search instance="search" className="pagefind-ui" searchboxOptions={{ placeholder: "search" }} />
```

See [Main.layout](packages/example/src/layouts/Main.astro) for a usage example.

### Pagefind 1.5.0

Pagefind has introduced [component-based UI](https://pagefind.app/docs/components/) in version 1.5.0.
It is now much easier to integrate Pagefind UI into Astro projects.
New users are encouraged to integrate Pagefind UI component directly instead of using the `astro-pagefind/components/Search.astro` component.
This component is now in maintenance mode and will not receive any new UI-related features anymore.
You have to import `astro-pagefind/components/PagefindConfig.astro` component to get the Pagefind bundle path wired correctly.

Here is how to get the searchbox UI on a page:

```astro
---
import PagefindConfig from "astro-pagefind/components/PagefindConfig.astro";
---

<PagefindConfig />
<pagefind-searchbox></pagefind-searchbox>
```

See [Main.layout](packages/example/src/layouts/Main.astro) for a more detailed example.

For more details and information on Pagefind UI please consult [Pagefind docs](https://pagefind.app/docs/components/searchbox/) directly.

---
_Source: https://npm.io/package/astro-pagefind · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
