4.10Guide
How to add search to an Astro site (Pagefind, Fuse.js, MiniSearch compared)
A static Astro site has no server to answer a search, so the browser searches an index file the build makes. We set up Pagefind, Fuse.js, MiniSearch and Astronomic Search on one 200-post site and measured what each one loads and finds.

On this page13 sections
Site search is the box that finds a page on your own site when a visitor types a few words. A static Astro site has no server to answer that question, so the build writes your pages’ words to files and the visitor’s browser searches them. We added four search tools to the same 200-post Astro site and measured each one: Pagefind for large sites, Astronomic Search for a ready dialog that forgives typos, and MiniSearch to build your own.
Try it first: the Astronomic Search page has a live search box. Type a word with a typo in it and see what it finds.
Tested November 21, 2026 (Astronomic Search again on November 23, from npm), with Astro 7.4, Pagefind 1.6, Fuse.js 7.5, MiniSearch 7.2 and Astronomic Search 0.1.
How search works on a static site
The build writes your pages’ words to files, and the browser loads them and searches them. Nothing runs on a server when someone searches. To search fast, a program needs an index: your pages’ words, arranged so it can find matches quickly. Some tools build the index ahead of time. Others ship plain records, and the browser builds the index from them.
At build time
Your pages
astro build writes the search files
Site deployed with them
In the visitor's browser
A visitor opens search
The browser loads the search files
One records file
Written during the build. The first search loads all of it, then the browser builds the index.
Fuse.js, MiniSearch, Astronomic Search
Index chunks
Indexed after astro build. Each search loads only the chunks it needs.
Pagefind
Results show
The tools differ in two ways:
- When the index is made. Pagefind reads your built HTML pages after
astro buildand writes a finished index. Fuse.js, MiniSearch and Astronomic Search read your content collections (Astro’s folders of Markdown posts, set up below) during the build and write plain records. The browser builds the index from those records on the first search, so these three also work inastro dev. Astronomic Search adds a small manifest that names the current records file, and starts loading on hover. - How much the browser loads. Fuse.js, MiniSearch and Astronomic Search load one file that holds the text of every page, the first time someone searches. Pagefind splits its index into small chunks and loads only the ones a search needs.
That second point decides most of the trade-off. One file is fast once it is loaded: every word is in memory, so the next search downloads nothing. But it grows with every post you add. Chunks keep the first search smaller, and each new word can fetch a new chunk.
The four options compared
On our 200-post test site, Pagefind loaded the least per search, Astronomic Search added the least to each page, and MiniSearch and Astronomic Search found every test query.
| Tool | Added to every page |
First search |
Next search |
Typo tolerant |
Heading links |
Ready UI | Works inastro dev |
|---|---|---|---|---|---|---|---|
| Pagefind | 47 KB | 122 KB 380 ms |
36 KB 340 ms |
No | Yes | Modal | No |
| Fuse.js | 9.6 KB | 147 KB 70 ms |
0 KB 50 ms |
Yes | No | No | Yes |
| MiniSearch | 6 KB | 148 KB 80 ms |
0 KB 15 ms |
Yes | No | No | Yes |
| Astronomic Search |
2.2 KB | 179 KB 190 ms |
0 KB 17 ms |
Yes | Yes | Dialog | Yes |
How we measured: one Astro 7 blog with 200 posts of about 850 words each, the same for every tool, with each tool’s minimal setup from this guide. We served each built site with gzip compression, as most hosts do, and opened it in a fresh browser three times, counted every byte the server sent, and timed the wait until five results showed. It ran on a fast desktop over a local connection, so on a phone network the downloads matter more than the times.
Notes on the table:
- Sizes are gzip sizes: the compressed bytes the server sends. “Added to every page” is the search code a page loads before anyone searches, over a 6.7 KB page with no search.
- Next search is a second, different word in the same page. Pagefind fetches a new chunk for it: 7 requests. The other three already have everything in memory.
- Heading links means a result can point to the section of a page that matched, such as
/posts/how-to-unpack-on-a-budget/#money-matters. Fuse.js and MiniSearch can do this if you split each post into one record per heading. The setups here do not. - Total deployed. Pagefind put 931 KB into the deploy, in 227 files, but a visitor downloads only a small part of it: the deploy holds all three of its UIs and one small file per page. Fuse.js and MiniSearch deployed 154 to 156 KB in 2 files. Astronomic Search deployed 192 KB in 5 files, including an 11 KB script for the
/search/page that loads only on that page. - Build time. Pagefind’s indexing step added 0.24 s to the build. Astronomic Search added about 0.1 s. Fuse.js and MiniSearch added 0.02 s or less, inside run-to-run noise.
- What the first search pays for. Of Astronomic Search’s 179 KB, 25 KB is the finished dialog: content-type tabs, filters with counts, heading links, highlights and keyboard navigation. The other 154 KB is the records, one for each page and each heading section. Pagefind loads its UI on every page (most of its 47 KB). Fuse.js and MiniSearch ship no UI, so you write and load your own on top of their numbers.
- Astronomic Search starts early. It loads on hover, and fetches its three files at once, so by the time the click lands, most of the first search is done. After a hover of a moment or more, click to results took about 51 ms.
The example site
Every setup below starts from the same small blog, the one we tested. If your posts are already in a content collection, skip to your tool.
-
Define the posts as a content collection: a folder of Markdown files that Astro reads and checks against a schema. Create
src/content.config.ts:import { defineCollection } from 'astro:content'; import { glob } from 'astro/loaders'; import { z } from 'astro/zod'; const posts = defineCollection({ loader: glob({ pattern: '**/*.md', base: './src/content/posts' }), schema: z.object({ title: z.string(), description: z.string(), date: z.coerce.date(), }), }); export const collections = { posts }; -
Put each post in
src/content/posts/, with a title, a description and a date at the top:--- title: "A Better Pan Sauce for Weeknights" description: "Three steps and one pan." date: 2025-07-18 --- The trick is to reduce slowly. -
Make a page for each post,
src/pages/posts/[slug].astro. The file name becomes the URL, so each post lives at/posts/<file name>/, and every search sample below links there:--- import { getCollection, render } from 'astro:content'; import Base from '../../layouts/Base.astro'; export async function getStaticPaths() { const posts = await getCollection('posts'); return posts.map((post) => ({ params: { slug: post.id }, props: { post } })); } const { post } = Astro.props; const { Content } = await render(post); --- <Base title={post.data.title} description={post.data.description}> <article> <h1>{post.data.title}</h1> <Content /> </article> </Base>Baseis your layout,src/layouts/Base.astro: the<html>,<head>and<header>every page shares, with a<slot />for the page. It takestitleanddescriptionprops and puts them in<title>and<meta name="description">. Each tool below adds to it. Keep a home page atsrc/pages/index.astrothat lists your posts, because the search links below point to/. -
In
astro.config.mjs, set your site’s address and end every URL with a slash:import { defineConfig } from 'astro/config'; export default defineConfig({ site: 'https://example.com', trailingSlash: 'always', });
The samples assume the site sits at the root of its domain. For a site in a subfolder, see Common problems.
How to add Pagefind to Astro
Pagefind indexes your built pages after astro build, and it ships a search modal. It is the search that Starlight, Astro’s docs theme, uses by default.
-
Install it:
pnpm add -D pagefind -
Run it after the Astro build, in
package.json:"scripts": { "build": "astro build && pagefind --site dist" } -
Add its stylesheet, its script and the modal to your layout,
src/layouts/Base.astro:<head> <link href="/pagefind/pagefind-component-ui.css" rel="stylesheet" /> <script is:inline src="/pagefind/pagefind-component-ui.js" type="module"></script> </head> <body> <header> <pagefind-modal-trigger></pagefind-modal-trigger> <pagefind-modal></pagefind-modal> </header>is:inlinetells Astro to leave the script alone. The/pagefind/files do not exist until Pagefind runs. -
Mark the part of each post to index, so the header, menu and footer stay out of results. In
src/pages/posts/[slug].astro:<article data-pagefind-body> -
Build and preview:
pnpm build pnpm astro preview
By default, the modal shows up to three heading links under each page result. For a full search page, create src/pages/search.astro in the same layout, so it gets the script and stylesheet from step 3:
---
import Base from '../layouts/Base.astro';
---
<Base title="Search">
<div id="search-page">
<pagefind-input></pagefind-input>
<pagefind-summary></pagefind-summary>
<pagefind-results></pagefind-results>
</div>
</Base>
What breaks: search does not work in astro dev. The /pagefind/ files exist only in dist after a build, so in dev the button never appears. Test search with pnpm build and pnpm astro preview. And Pagefind has no typo tolerance: both of our typo queries returned nothing.
The Pagefind docs cover filters, weighting and the other two UIs.
How to add Fuse.js to Astro
Fuse.js is a small fuzzy-search library: it scores how close each record is to the query, so near misses still match. You write a file of records at build time and a search box that searches it.
-
Install it:
pnpm add fuse.js -
Write every post to
/search.jsonwith an endpoint. Createsrc/pages/search.json.ts:import type { APIRoute } from 'astro'; import { getCollection } from 'astro:content'; // Strip Markdown down to plain words. Simple on purpose. function toPlainText(md: string) { return md .replace(/```[\s\S]*?```/g, ' ') // code blocks .replace(/`([^`]*)`/g, '$1') // inline code .replace(/!\[[^\]]*\]\([^)]*\)/g, ' ') // images .replace(/\[([^\]]*)\]\([^)]*\)/g, '$1') // links: keep the text .replace(/^#{1,6}\s+/gm, '') // heading marks .replace(/[*_~>|]/g, '') // emphasis, quotes, tables .replace(/\s+/g, ' ') .trim(); } export const GET: APIRoute = async () => { const posts = await getCollection('posts'); const records = posts.map((post) => ({ title: post.data.title, description: post.data.description, body: toPlainText(post.body ?? ''), slug: post.id, })); return new Response(JSON.stringify(records), { headers: { 'Content-Type': 'application/json' }, }); };The endpoint writes every post that the post route builds. If your route leaves some out, such as drafts, filter both the same way, or the draft’s text ships in
search.json. With adraftfield in the schema, that isgetCollection('posts', ({ data }) => !data.draft)in both files. -
Create the search box,
src/components/Search.astro. It fetches the file on first focus and searches it on each keystroke:<div class="fuse-search"> <input id="fuse-input" type="search" placeholder="Search posts" aria-label="Search posts" autocomplete="off" /> <ul id="fuse-results"></ul> </div> <script> import Fuse from 'fuse.js'; type Post = { title: string; description: string; body: string; slug: string }; const input = document.querySelector<HTMLInputElement>('#fuse-input')!; const list = document.querySelector<HTMLUListElement>('#fuse-results')!; let fuse: Promise<Fuse<Post>> | undefined; // Fetch the records once, on first focus or input. function load() { fuse ??= fetch('/search.json') .then((res) => res.json()) .then( (posts: Post[]) => new Fuse(posts, { keys: [ { name: 'title', weight: 3 }, { name: 'description', weight: 2 }, { name: 'body', weight: 1 }, ], ignoreLocation: true, // else words past the first ~60 characters are missed }), ); return fuse; } async function search() { const query = input.value.trim(); if (!query) { list.replaceChildren(); return; } const results = (await load()).search(query, { limit: 10 }); if (query !== input.value.trim()) return; // a newer query is running list.replaceChildren( ...results.map(({ item }) => { const li = document.createElement('li'); const a = document.createElement('a'); a.href = `/posts/${item.slug}/`; a.textContent = item.title; li.append(a); return li; }), ); } input.addEventListener('focus', load, { once: true }); input.addEventListener('input', search); </script> <style> .fuse-search { position: relative; } #fuse-results { position: absolute; right: 0; z-index: 10; width: 22rem; margin: 0; padding: 0; list-style: none; background: white; box-shadow: 0 4px 16px rgb(0 0 0 / 0.15); } #fuse-results:empty { display: none; } #fuse-results :global(a) { display: block; padding: 0.5rem 0.75rem; } </style>Astro scopes a component’s styles to the elements in its markup. The script makes the links later, so their rule needs
:global(a). -
Import it in your layout and put
<Search />in the header:--- import Search from '../components/Search.astro'; --- <header> <Search /> </header>
Search works in astro dev too, because the endpoint runs there.
What breaks: Fuse.js gave the weakest results of the four with its defaults. Its default threshold of 0.6 lets nearly every post match something, so a nonsense word still showed 10 results. It treats “heron lantern festival” as one fuzzy pattern, not three words, so the one post with all three did not rise. A rare word deep in a long post ranked low. Lowering threshold is the usual fix: test it on your own content. Fuse.js 7.5 also has a useTokenSearch option that matches each word of the query on its own (token search). We did not test it. Leave ignoreLocation: true in: without it, Fuse.js only scores matches near the start of each field and misses most of a long post.
Fuse.js scans every record on each keystroke, so its search time grows with your text. It was the slowest of the in-memory tools on a second search: 50 ms, against 14 to 15 ms for the other two.
How to add MiniSearch to Astro
MiniSearch is a full-text search library: it builds a real index in the browser, with prefix and typo matching as options. It found all seven of our test queries with three settings, and it is the engine inside Astronomic Search.
-
Install it:
pnpm add minisearch -
Write
src/pages/search.json.tsas in the Fuse.js steps above, with the sametoPlainTextand the same filter. Change only the records: give each anid(MiniSearch needs one) and itsurl:const records = posts.map((post) => ({ id: post.id, title: post.data.title, description: post.data.description, body: toPlainText(post.body ?? ''), url: `/posts/${post.id}/`, }));Our tested MiniSearch copy differed in one small way: its
toPlainTextkept image alt text and table pipes. Our posts have neither. -
Create
src/components/Search.astro. It fetches the records on first focus and builds the index in the browser:<div class="search"> <input id="search-input" type="search" placeholder="Search posts" aria-label="Search posts" autocomplete="off" /> <ul id="search-results"></ul> </div> <script> import MiniSearch from 'minisearch'; type Post = { id: string; title: string; description: string; body: string; url: string }; const input = document.querySelector<HTMLInputElement>('#search-input')!; const list = document.querySelector<HTMLUListElement>('#search-results')!; let ready: Promise<MiniSearch<Post>> | undefined; // Fetch the records once, then build the index in the browser. function load() { ready ??= fetch('/search.json') .then((res) => res.json()) .then((posts: Post[]) => { const miniSearch = new MiniSearch<Post>({ fields: ['title', 'description', 'body'], storeFields: ['title', 'url'], searchOptions: { prefix: true, fuzzy: 0.2, boost: { title: 2 } }, }); miniSearch.addAll(posts); return miniSearch; }); return ready; } async function search() { const miniSearch = await load(); const query = input.value.trim(); const results = query ? miniSearch.search(query).slice(0, 10) : []; list.replaceChildren( ...results.map((result) => { const li = document.createElement('li'); const a = document.createElement('a'); a.href = result.url; a.textContent = result.title; li.append(a); return li; }), ); } input.addEventListener('focus', load, { once: true }); input.addEventListener('input', search); </script> -
Import it in your layout and put
<Search />in the header, as for Fuse.js. To style it, copy the Fuse.js<style>block and rename.fuse-searchto.searchand#fuse-resultsto#search-results.
The three searchOptions do the work: prefix: true matches words as they are typed, fuzzy: 0.2 forgives a typo or two, and boost ranks title matches higher. Building the index from 200 posts took about 45 ms in the browser, inside the 80 ms first search.
What you build yourself: everything a visitor sees. This setup shows plain title links: no snippets, no highlighted words, no keyboard navigation, no heading links and no fallback with JavaScript off. The MiniSearch docs cover the options.
How to add Astronomic Search
Astronomic Search is our free Astro integration (a package that adds to the build from astro.config.mjs), built on MiniSearch. It indexes your pages and their headings at build time and ships a finished search dialog. It loads the most data on a first search of the four here, 179 KB on our test site, because it keeps a record for each heading section as well as each page.
What you get without writing UI code:
- A dialog that opens from a button,
mod+k(Cmd+K or Ctrl+K) or/, with keyboard navigation. - Typo tolerance, and highlights only on real matches, so a typo match never marks the wrong word.
- Results that link to the heading where the words matched.
- A tab for each content type and filters by your own fields, such as theme or author, each with a result count.
- A button that is a real link to your search page, so it still goes somewhere with JavaScript off.
- Search in
astro dev.
-
Install it:
pnpm add @astronomic-dev/search -
Add the integration to
astro.config.mjs.collections()reads a content collection, hereposts.browselists the links shown when JavaScript is off. Eachhrefmust be the page’s exact URL, with the trailing slash yourtrailingSlashsetting asks for, or the build fails:import { defineConfig } from 'astro/config'; import search, { collections } from '@astronomic-dev/search/astro'; export default defineConfig({ site: 'https://example.com', trailingSlash: 'always', integrations: [ search({ sources: [collections({ posts: { label: 'Posts' } })], browse: [{ label: 'Posts', href: '/' }], }), ], });A collection’s pages are found at
/<collection>/<id>by default, which matches the example site’s/posts/route. Drafts are left out for you. If yours differ, set the pattern, as inblog: { url: "/posts/{slug}" }. -
Put the button in your layout’s header:
--- import SearchLink from "@astronomic-dev/search/astro/SearchLink.astro"; import SearchNoscript from "@astronomic-dev/search/astro/SearchNoscript.astro"; --- <header> <SearchLink class="search-button">Search</SearchLink> <SearchNoscript /> </header> -
Add the search page. The button links to
/search/(/searchwithouttrailingSlash: 'always'), and “See all results” in the dialog goes there with the query as?q=. Add the page with theSearchPagecomponent, inside your own layout. It reads?q=, lists the matching pages, and shows your browse links with JavaScript off. Createsrc/pages/search.astro:--- // src/pages/search.astro: where "See all results" and the no-JavaScript link go. Use your own layout in place of // this html shell, and keep the noindex tag. import SearchPage from "@astronomic-dev/search/astro/SearchPage.astro"; --- <html lang="en"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="robots" content="noindex" /> <title>Search</title> </head> <body> <main> <SearchPage /> </main> </body> </html>In your own layout, put
<SearchPage />where the page body goes. It takesheading(default “Search”,""for none),label(the search box’s label, default “Search this site”),button(default “Search”) andclass. It reads<html lang>to pick the index’s language. -
Build and preview, or run
pnpm dev:pnpm build pnpm astro preview
Each page loads a script of about 2 KB. The dialog code and the index load on first hover, focus, click or mod+k.
Go further: content types, shortcut and colors
With two or more content types, the dialog shows a tab for each. Add a second collection, and set the shortcut and colors to fit your site. This example assumes a docs collection with its own src/pages/docs/[slug].astro route and a /docs/ index page:
search({
sources: [collections({ posts: { label: 'Posts' }, docs: { label: 'Docs' } })],
shortcut: { keys: ['mod+k'] },
browse: [{ label: 'Posts', href: '/' }, { label: 'Docs', href: '/docs/' }],
});
astronomic-search {
--search-accent: #c2410c;
--search-radius: 0.5rem;
}
The Astronomic Search page has a live demo on this site’s own content, plus the settings for filters, synonyms, pinned results and analytics events.
Search test: typos, prefixes and phrases
MiniSearch and Astronomic Search found all seven test queries. Pagefind missed both typos, and Fuse.js missed four with its defaults. These are default setups on one test site, so read the table as a quick check, not a ranking.
| Query kind | Pagefind | Fuse.js | MiniSearch | Astronomic Search |
|---|---|---|---|---|
| Exact post title | Found | Found | Found | Found |
Typo in a title: quilwort |
Missed | Found | Found | Found |
Typo in a heading: spokshave |
Missed | Missed | Found | Found |
Start of a word: thermocl |
Found | Found | Found | Found |
Three words: heron lantern festival |
Found | Missed | Found | Found |
Rare word deep in a post: vellichor |
Found | Missed | Found | Found |
Nonsense, should find nothing: xylophaxqz |
No results | 10 wrong results: Wrong results | No results | No results |
A green check means the right post was in the top five, and in every case it was first. For the nonsense word, it means the search showed no results. Pagefind and Astronomic Search also linked to the right heading for three of their four heading targets. Fuse.js and MiniSearch return whole posts in these setups, so they never link to a heading.
Other options: FlexSearch, Orama and Algolia DocSearch
We did not test these three, but each is a real choice:
- FlexSearch is a fast full-text search library for the browser. Like MiniSearch, you write the UI.
- Orama is a search engine in JavaScript that runs in the browser, with an Astro plugin and a hosted cloud version.
- Algolia DocSearch is hosted: Algolia crawls your site and answers searches from its servers. DocSearch is its free program for documentation sites. For other sites, Algolia has a free plan with a usage cap and charges past it.
Deploy it
All four deploy as plain static files, so any static host works. Each build rebuilds the index from your content, so a new or changed post is searchable after the next deploy.
| Tool | You add | Build command | Deployed |
|---|---|---|---|
| Pagefind | Tags in the layout, an attribute on posts | astro build && pagefind --site dist |
dist/pagefind/ |
| Fuse.js | An endpoint and a search box | astro build |
search.json and a script in _astro/ |
| MiniSearch | An endpoint and a search box | astro build |
search.json and a script in _astro/ |
| Astronomic Search | The integration, a button, a /search page |
astro build |
_search/ |
Notes per tool:
-
Pagefind indexes only the HTML files in
dist. A page rendered on demand by a server route is never in its index. -
Fuse.js and MiniSearch build
search.jsononce, at build time, in a static site. Withoutput: "server", addexport const prerender = trueto the endpoint so it is still built once (on-demand rendering). -
Astronomic Search reads collections at build time, so their pages are in the index whether they are built ahead or on demand. Its files have a hash in their names except
manifest.json. Cache the hashed files for a long time and the manifest briefly, so visitors see a new deploy. On Cloudflare, apublic/_headersfile does it:/_search/* Cache-Control: public, max-age=31536000, immutable /_search/manifest.json ! Cache-Control Cache-Control: public, max-age=0, must-revalidate
Common problems
Most search bugs come from testing in dev, a base path (a site served from a subfolder, such as /blog/), a strict security policy or an index that has grown too big.
Search is empty in astro dev. Pagefind’s files exist only after a build, so run pnpm build and pnpm astro preview. The same goes for Astronomic Search’s html() source, which scans built pages. Its collections() source works in dev.
Results link to the wrong place under a base path. The samples assume the site sits at the domain root. With base: '/blog', a hard-coded /search.json, /posts/ or /pagefind/ address misses. Build each one from import.meta.env.BASE_URL, which is /blog/ with trailingSlash: 'always':
-
Fuse.js and MiniSearch: fetch
`${import.meta.env.BASE_URL}search.json`, and put the same prefix on each result link, as in`${import.meta.env.BASE_URL}posts/${post.id}/`. -
Pagefind: prefix the stylesheet
hrefand the scriptsrcthe same way, and add this next to the modal, since the script cannot find its own folder:<pagefind-config bundle-path={`${import.meta.env.BASE_URL}pagefind/`}></pagefind-config>Its result links then get the base on their own.
-
Astronomic Search:
SearchLinkand the result links add yourbasefor you. Write it intobrowselinks:href: '/blog/'.
Search breaks under a strict Content Security Policy. Pagefind runs WebAssembly, which needs 'wasm-unsafe-eval' in script-src, and it searches in a Web Worker, which can need worker-src 'self' blob: (Pagefind’s hosting docs). Astro inlines small stylesheets into the page, which style-src 'self' blocks. Set build: { inlineStylesheets: 'never' } in astro.config.mjs to ship them as files. Astronomic Search ships its scripts as files and its styles as a constructable stylesheet, so script-src 'self'; style-src 'self' works.
The first search gets slow. Fuse.js, MiniSearch and Astronomic Search download the text of every page in one file. That was 147 to 179 KB at 200 posts, and it grows with each post. Index less text (titles, descriptions and headings, not whole bodies), or move to Pagefind’s chunks. Astronomic Search has a clip setting that keeps only the start of each section, and a budget that warns at build time when the file passes a size you set.
A nonsense word returns results. That is Fuse.js’s loose default threshold. Lower it and test again.
“See all results” lands on an empty page. Astronomic Search links to /search/, and the page is yours to add. Add it with SearchPage as in step 4, or set href on SearchLink to another page.
Which one to pick
Each tool won something on our test site. Pick by what your site needs most.
Pick Pagefind if your site is large or growing fast, or you run Starlight. Each search loads only the index chunks it needs, it links to headings, and setup is a build script and a few tags. Accept no typo tolerance and no search in dev.
Pick Astronomic Search if you want a finished dialog with typo tolerance, heading links, content-type tabs and filters, mod+k and a link that works without JavaScript, and you want it in dev too. Accept the largest first search of the four, which it starts loading on hover.
Pick MiniSearch if you want to design your own search UI. It found every test query with three settings and adds 6 KB to each page.
Pick Fuse.js if you already use it, or you search short records such as product names. Tune threshold first.
When you do not need site search
A small site with a clear menu does not need search. Visitors find a page by scanning the menu faster than by guessing a word, and Google already searches your site with site:example.com. Add search when people start asking where something is, or when a blog or docs section grows past what one menu can show.
To try a finished one, open the search on this site’s Astronomic Search page. It searches this site’s own pages.


