Pagefind.Net.Frontend
0.3.0
dotnet add package Pagefind.Net.Frontend --version 0.3.0
NuGet\Install-Package Pagefind.Net.Frontend -Version 0.3.0
<PackageReference Include="Pagefind.Net.Frontend" Version="0.3.0" />
<PackageVersion Include="Pagefind.Net.Frontend" Version="0.3.0" />
<PackageReference Include="Pagefind.Net.Frontend" />
paket add Pagefind.Net.Frontend --version 0.3.0
#r "nuget: Pagefind.Net.Frontend, 0.3.0"
#:package Pagefind.Net.Frontend@0.3.0
#addin nuget:?package=Pagefind.Net.Frontend&version=0.3.0
#tool nuget:?package=Pagefind.Net.Frontend&version=0.3.0
Pagefind.Net.Frontend
Ships the Pagefind browser query runtime (pagefind.js and wasm.en.pagefind) as embedded resources. An MSBuild target automatically extracts the files into your project on build -- no npm install required.
Ships Pagefind 1.5.2 runtime.
Automatic extraction
Install the package and the frontend files appear in wwwroot/pagefind/ after every build:
dotnet add package Pagefind.Net.Frontend
The output path is configurable in your .csproj:
<PropertyGroup>
<PagefindFrontendOutputPath>wwwroot/pagefind</PagefindFrontendOutputPath>
</PropertyGroup>
To disable automatic extraction entirely:
<PropertyGroup>
<PagefindFrontendDisableExtract>true</PagefindFrontendDisableExtract>
</PropertyGroup>
Programmatic API
Extract the runtime files from code using PagefindFrontend.ExtractToAsync:
using Pagefind.Net.Frontend;
string[] written = await PagefindFrontend.ExtractToAsync("wwwroot/pagefind");
The method writes files only when the embedded version is newer than what is already on disk (tracked via a version marker file). Pass force: true to always overwrite.
An overload accepting IFileSystem is available for testing.
ASP.NET integration
ASP.NET does not recognize Pagefind's custom file extensions by default. Register them in your static file middleware:
using Microsoft.AspNetCore.StaticFiles;
var contentTypeProvider = new FileExtensionContentTypeProvider();
contentTypeProvider.Mappings[".pf_meta"] = "application/octet-stream";
contentTypeProvider.Mappings[".pf_index"] = "application/octet-stream";
contentTypeProvider.Mappings[".pf_fragment"] = "application/octet-stream";
contentTypeProvider.Mappings[".pagefind"] = "application/wasm";
app.UseStaticFiles(new StaticFileOptions { ContentTypeProvider = contentTypeProvider });
Without these mappings, the Pagefind JS runtime will receive 404 responses when loading index data.
Documentation
Full documentation: nullean.github.io/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.IO.Abstractions (>= 22.0.9)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.