Pagefind.Net
0.6.0
dotnet add package Pagefind.Net --version 0.6.0
NuGet\Install-Package Pagefind.Net -Version 0.6.0
<PackageReference Include="Pagefind.Net" Version="0.6.0" />
<PackageVersion Include="Pagefind.Net" Version="0.6.0" />
<PackageReference Include="Pagefind.Net" />
paket add Pagefind.Net --version 0.6.0
#r "nuget: Pagefind.Net, 0.6.0"
#:package Pagefind.Net@0.6.0
#addin nuget:?package=Pagefind.Net&version=0.6.0
#tool nuget:?package=Pagefind.Net&version=0.6.0
Pagefind.Net

A pure .NET indexer that generates a Pagefind-compatible search index. No native Rust binary or subprocess: the whole indexing pipeline runs in managed code and is AOT-compatible.
Install
dotnet add package Pagefind.Net
Quick start
using Pagefind.Net;
var index = new PagefindIndex(new PagefindIndexOptions { Language = "en" });
index.AddRecord(new PagefindRecord
{
Url = "/guide/",
Title = "Getting started",
Content = "Install the package, add your pages, write the index.",
WeightedSegments =
[
new WeightedSegment("Getting started", Weight: 7), // h1
new WeightedSegment("Install the package, add your pages, write the index.", Weight: 1), // body
],
Anchors = [new PagefindAnchor(ElementId: "install", Text: "Install", Location: 0, Tag: "h2")],
Meta = new Dictionary<string, string> { ["title"] = "Getting started" },
});
await index.WriteAsync("wwwroot"); // wwwroot/pagefind/: pagefind-entry.json, *.pf_meta, index/, fragment/
WriteAsync writes all index data files into wwwroot/pagefind/:
pagefind-entry.jsonpagefind.{hash}.pf_metaindex/{hash}.pf_indexfragment/{hash}.pf_fragment
Pages already parsed into headings and text can go in as HtmlPageData, weighted as the Pagefind binary does:
using Pagefind.Net;
var index = new PagefindIndex();
// Headings and body text in document order: the heading levels set the weights, as the Pagefind binary does.
index.AddHtmlRecord(new HtmlPageData
{
Url = "/guide/",
Sections =
[
new HtmlSection("h1", "Getting started"),
new HtmlSection("p", "Install the package, add your pages, write the index."),
],
});
await index.WriteAsync("wwwroot");

Key types
| Type | Description |
|---|---|
PagefindIndex |
Accumulates records and writes the index via WriteAsync. |
PagefindRecord |
A single searchable document with URL, title, content, segments, anchors, metadata and filters. |
HtmlPageData |
A page as headings and text in document order, for AddHtmlRecord. |
WeightedSegment |
A text segment with a search weight (body = 1, H2 = 4, H1 = 7). |
PagefindAnchor |
A heading anchor for sub-page deep links in search results; Location is a word offset into Content. |
PagefindIndexOptions |
Language, extra characters to index, merge batch size and the meta fields to index. |
Frontend runtime
This package writes only the index data files. The Pagefind query runtime (pagefind.js and
wasm.en.pagefind) comes separately: install Pagefind.Net.Frontend,
which ships the runtime and extracts it on build, or the pagefind npm
package and copy the runtime files yourself.
Targets Pagefind 1.5.2 (PagefindIndex.PagefindTargetVersion). Reference: https://pagefind.nullean.net/reference/pagefind-index/
Learn more
- Documentation: https://pagefind.nullean.net
- Source and issues: https://github.com/nullean/pagefind-net
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- System.Formats.Cbor (>= 11.0.0)
- System.IO.Abstractions (>= 23.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.