Conversation
Replaces Pagefind's build-time static search index with Algolia's crawler-based search. The index is populated automatically by Algolia's crawler — no build step needed. Adds a custom InstantSearch modal component that is theme-aware (light/dark) and uses the brand red for hit highlights. Also fixes a pre-existing bug where site.webmanifest 404'd in dev because the middleware matcher didn't exclude .webmanifest files. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
`React.ComponentType<{ components?: ... }>` was incompatible with
`MDXContent` returned by @mdx-js/mdx's evaluate(), due to React 19
components returning ReactNode (including undefined) while @types/mdx
expects Element | null. Using React.ElementType resolves the boundary
without type suppressions.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
not related but docs weren't building right on my branch until i made this change.
- Only initialize algoliasearch when all three env vars are present; show a setup instructions message in the modal otherwise - Add safeHref() to reject non-relative/non-https hit URLs (XSS defense) - Remove unused inputRef, FOCUS_DELAY_MS, and the focus useEffect — SearchBox autoFocus already handles this correctly Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@uidotdev/usehooks is already a dependency. useEventListener handles add/remove lifecycle internally, removing the boilerplate. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replaces hardcoded hsl(347 ...) values with var(--primary) from @arcadeai/design-system tokens and color-mix() for transparent tints. Dark mode text override removed since --primary resolves identically in both modes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace hardcoded neutral/dark: pairs with semantic tokens where the mapping is clean and visually equivalent: - text-neutral-900 dark:text-white → text-foreground - text-neutral-400/500 dark:text-neutral-500/400 → text-muted-foreground - border-neutral-200/300 dark:border-white/10 → border-border - bg-white dark:bg-neutral-900 (modal panel) → bg-popover Hover states on hits and the trigger button bg retain explicit neutral/white values since bg-muted dark resolves too dark for those. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…idotdev/usehooks@2.4.1 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| useEffect(() => { | ||
| const handler = (e: KeyboardEvent) => { | ||
| if ((e.metaKey || e.ctrlKey) && e.key === "k") { | ||
| e.preventDefault(); | ||
| setIsOpen((prev) => !prev); | ||
| } | ||
| if (e.key === "Escape") { | ||
| setIsOpen(false); | ||
| } | ||
| }; | ||
| window.addEventListener("keydown", handler); | ||
| return () => window.removeEventListener("keydown", handler); | ||
| }, []); |
There was a problem hiding this comment.
it would be neat to either upgrade @uidotdev/usehooks to a verstion that has useEventListener or use https://tanstack.com/hotkeys/latest (never tried it but tanstack is usually legit)
but for now, a useEffect is the best i've got
| "react": "19.2.3", | ||
| "react-dom": "19.2.3", | ||
| "react-hook-form": "7.65.0", | ||
| "react-instantsearch": "^7.26.0", |
There was a problem hiding this comment.
algolia's react library https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/react
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| hitComponent={({ hit }) => ( | ||
| <SearchHit hit={hit as unknown as HitRecord} /> | ||
| )} | ||
| /> |
There was a problem hiding this comment.
Hits component always renders alongside empty query message
Medium Severity
The Hits component renders unconditionally, but Algolia returns results for empty queries by default. When the search modal opens, users see the "Start typing to search the docs…" message from EmptyQuery and a list of search results from Hits at the same time. The Hits component needs to be conditionally hidden when no query has been entered.
Additional Locations (1)
There was a problem hiding this comment.
I think this is fine? I like the way this shows top docs pages and also prompts for input when empty. Open to other opinions.
| export const config = { | ||
| matcher: [ | ||
| "/((?!api|_next/static|_next/image|favicon.ico|manifest|_pagefind|public|.*.svg|.*.png|.*.jpg|.*.jpeg|.*.gif|.*.webp|.*.ico|.*.css|.*.js|.*.woff|.*.woff2|.*.ttf|.*.eot|.*.otf|.*.pdf|.*.txt|.*.xml|.*.json|.*.py|.*.mp4).*)", | ||
| "/((?!api|_next/static|_next/image|favicon.ico|manifest|public|.*.svg|.*.png|.*.jpg|.*.jpeg|.*.gif|.*.webp|.*.ico|.*.webmanifest|.*.css|.*.js|.*.woff|.*.woff2|.*.ttf|.*.eot|.*.otf|.*.pdf|.*.txt|.*.xml|.*.json|.*.py|.*.mp4).*)", |
There was a problem hiding this comment.
I had a bunch of 404s locally from this. Idk if I should have just ignored them. This fixed it.


Summary
AlgoliaSearchcomponent usingreact-instantsearchwith a keyboard-accessible modal (⌘K), theme-aware light/dark styling, and brand red hit highlightspagefind,rehype-stringify,remark,remark-rehypedeps and thecustompagefindbuild script/site.webmanifest404'd because the middleware matcher didn't exclude.webmanifestfilesTest plan
pnpm buildcompletes without a Pagefind step🤖 Generated with Claude Code
Note
Medium Risk
Medium risk because it swaps the site search implementation and removes the build-time indexing step; misconfigured Algolia env vars or index settings would leave search unavailable. Also tweaks middleware matching for
.webmanifest, which could affect routing if the matcher regex is wrong.Overview
Switches docs search from build-time Pagefind indexing to Algolia crawler-based search by disabling Nextra’s built-in search, adding a client-side
AlgoliaSearchmodal (button + ⌘/Ctrl+K, hit highlighting, empty/no-results states), and wiring it into the main layout.Removes the Pagefind tooling and build hooks (
scripts/pagefind.ts,custompagefindscripts, related deps) and updates styling/env examples for Algolia configuration. Also fixes a routing edge case by excluding.webmanifestfiles from the middleware matcher so/site.webmanifestis served correctly.Written by Cursor Bugbot for commit 79545f9. This will update automatically on new commits. Configure here.