Search
Choose between the built-in search, Pagefind static search, or Algolia DocSearch.
Search
Docyard ships with three search backends. The active one is selected with
docyard.search.backend in your site's app.config.ts (or, in
managed mode, via the flake
option). The default keeps the existing behavior, so no change is needed unless
you opt in.
| Backend | Index built | Server needed | Best for |
|---|---|---|---|
content | at runtime | no¹ | development and small sites (the default) |
pagefind | at build | no | large, fully static deployments |
algolia | hosted | no | projects already using Algolia DocSearch |
¹ The built-in search downloads the full Nuxt Content SQLite database to the browser on first use, which grows with the site.
Built-in (default)
export default defineAppConfig({
docyard: {
search: { backend: "content" },
},
});
Nothing to install. Search runs entirely client-side over the content database.
Pagefind
Pagefind builds a tiny static index after the site is prerendered and ships a small WASM runtime — no server, works on any static host (GitHub Pages, Cloudflare Pages, …).
export default defineAppConfig({
docyard: {
search: { backend: "pagefind" },
},
});
Add pagefind to your site's dev dependencies:
bun add -D pagefind
The theme runs pagefind against the prerendered output automatically at the
end of the build — there is no extra build step to wire up.
- Managed mode: setting
docyard.site.search.backend = "pagefind"is all that is required; the flake exports the build-time signal for you. - Explicit mode: also set
DOCYARD_SEARCH_BACKEND=pagefindwhen building, e.g.DOCYARD_SEARCH_BACKEND=pagefind nuxt generate. A file-basedapp.config.tsisn't visible to the build hook that runs Pagefind, so this env var is what triggers the index build (theapp.config.tsvalue still drives the search UI).
Algolia DocSearch
DocSearch is free for open-source projects. Once your site is accepted into the program you receive an application ID, a search-only API key, and an index name:
export default defineAppConfig({
docyard: {
search: {
backend: "algolia",
algolia: {
appId: "XXXXXXXXXX",
apiKey: "0000000000search-only-key",
indexName: "my-project",
},
},
},
});
The API key is the public, search-only key and is safe to commit. Add the DocSearch client to your site's dependencies:
bun add @docsearch/js @docsearch/css