Skip to content
项目

关于

用于 Pagefind 静态网站搜索的 Astro 集成。

网站与应用开发

这些数字如何统计

可以做什么

  • 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个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

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.

探索相关项目

加载中…