Before you start
The pinned Pagefind 1.6.0 release was published November 1, 2026. This uses its Component UI and the static CLI. This is not an access-control system.
- What you’ll make
- Three static HTML pages plus a search index and a local smoke test.
- What you’ll need
- A recent Node.js LTS, npm, Python 3 and a platform supported by Pagefind’s npm binaries. Use Bash; keep the test on loopback.
Step by step
Make a public-only fixture
Write two uniquely worded guide pages and a home search page. Give articles data-pagefind-body to keep navigation chrome out of the index. Do not place unpublished, private, or account material in the publishing directory.
Install and index
Pin Pagefind as a project dependency. Disable npm lifecycle scripts. Build the index after all pages are written; the index and its dependencies must ship with the public output.
Connect the built-in search box
Load the bundled component stylesheet and module on the homepage. The relative asset paths in this bare-root starter assume the search page and pagefind directory share the same parent. Serve over HTTP; file URLs are not a preview.
Verify the scope and links
Confirm that querying each unique term routes to the correct guide, nonsense finds no match, and keyboard results open correctly. Rerun indexing whenever published content changes. A client-side index can be downloaded, so never use it to hide protected content.
Commands
export npm_config_cache="$PWD/.npm-cache"
npm init -y
npm install --save-dev --save-exact --ignore-scripts pagefind@1.6.0
npx --no-install pagefind --version
mkdir -p dist/guides
cat > dist/index.html <<'EOF'
<!doctype html><html lang="en"><meta charset="utf-8">
<title>Guide library</title>
<link rel="stylesheet" href="./pagefind/pagefind-component-ui.css">
<script type="module" src="./pagefind/pagefind-component-ui.js"></script>
<h1>Guide library</h1><pagefind-searchbox></pagefind-searchbox>
<p><a href="guides/posters.html">Posters</a> · <a href="guides/subtitles.html">Subtitles</a></p>
</html>
EOF
cat > dist/guides/posters.html <<'EOF'
<!doctype html><html lang="en"><meta charset="utf-8"><title>Poster workflow</title>
<main data-pagefind-body><h1>Poster workflow</h1><p>Review a saffron storyboard.</p></main></html>
EOF
cat > dist/guides/subtitles.html <<'EOF'
<!doctype html><html lang="en"><meta charset="utf-8"><title>Subtitle workflow</title>
<main data-pagefind-body><h1>Subtitle workflow</h1><p>Prepare a verbatim transcription.</p></main></html>
EOF
npx --no-install pagefind --site dist
test -s dist/pagefind/pagefind-component-ui.js
test -s dist/pagefind/pagefind-component-ui.css
python3 -m http.server 8123 --directory dist --bind 127.0.0.1Sign-in & permissions
No account, API key, or external upload. A public dependency download may be needed. Pause before a system install; do not work around a restriction.
No agent skill, plugin, or MCP connector required.
Prompt for your agent
Use with: Codex, Claude Code, or another agent with local terminal and file access. Commands use Bash or a compatible shell.
Copy the whole prompt into a supported agent. After any manual step, tell the same agent to continue from that step.
Use a clean project folder for this workflow: Add browser-side search to a static site with Pagefind. Supported setup: Codex, Claude Code, or another agent with local terminal and file access. Commands use Bash or a compatible shell.. Start from the original documentation: https://pagefind.app/docs/.
1. SET UP
Start in a new project folder and check the listed tools. Use the pinned package or official platform build, no global upgrades. Check each command against its official source and stop on missing permissions or capabilities.
Documented commands or code reference (respect the comments and replace placeholders before running individual commands):
export npm_config_cache="$PWD/.npm-cache"
npm init -y
npm install --save-dev --save-exact --ignore-scripts pagefind@1.6.0
npx --no-install pagefind --version
mkdir -p dist/guides
cat > dist/index.html <<'EOF'
<!doctype html><html lang="en"><meta charset="utf-8">
<title>Guide library</title>
<link rel="stylesheet" href="./pagefind/pagefind-component-ui.css">
<script type="module" src="./pagefind/pagefind-component-ui.js"></script>
<h1>Guide library</h1><pagefind-searchbox></pagefind-searchbox>
<p><a href="guides/posters.html">Posters</a> · <a href="guides/subtitles.html">Subtitles</a></p>
</html>
EOF
cat > dist/guides/posters.html <<'EOF'
<!doctype html><html lang="en"><meta charset="utf-8"><title>Poster workflow</title>
<main data-pagefind-body><h1>Poster workflow</h1><p>Review a saffron storyboard.</p></main></html>
EOF
cat > dist/guides/subtitles.html <<'EOF'
<!doctype html><html lang="en"><meta charset="utf-8"><title>Subtitle workflow</title>
<main data-pagefind-body><h1>Subtitle workflow</h1><p>Prepare a verbatim transcription.</p></main></html>
EOF
npx --no-install pagefind --site dist
test -s dist/pagefind/pagefind-component-ui.js
test -s dist/pagefind/pagefind-component-ui.css
python3 -m http.server 8123 --directory dist --bind 127.0.0.1
2. PAUSE FOR ME IF NEEDED
For a host install, sign-in, permission screen, or model download that needs my consent, stop and tell me the exact app, control and what will be authorized. Do not enter passwords, OTPs or secrets in chat. Resume after I confirm.
3. BUILD THE FIRST RESULT
Build the supplied fixture and test saffron, verbatim and zzznotfound. Check keyboard access and the result URLs if you have a browser. Leave the HTML and package-lock.json for rebuilding; close the preview server at the end. Do not index any files outside the demonstration folder or deploy anything.
4. CHECK THE RESULT
Require both search assets and valid links to the expected article in the actual search UI. If you only have terminal access, check the build and assets, and leave interactive search and keyboard checks outstanding. Give me the actual file paths and anything that still needs a manual action. Do not publish or make a purchase.