Skip to content
プロジェクト

概要

Pagefind の静的サイト検索を Astro に統合します。

Web・アプリ開発

この数値の測り方

できること

  • 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

計測したスター増加

24時間
0
7日間
0
15日間
0
1か月
履歴を収集中

期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。

Astro-Pagefind

CI npm

Astro integration for Pagefind 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
  • Allows passing index config to pagefind

Usage

Install:

npm i astro-pagefind

Add integration to the Astro config:

//astro.config.ts

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

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

Add search component on a page:

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

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

See Main.layout for a usage example.

Pagefind 1.5.0

Pagefind has introduced component-based UI 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:

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

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

See Main.layout for a more detailed example.

For more details and information on Pagefind UI please consult Pagefind docs directly.

関連プロジェクトを探す

読み込み中…