Add /search page backed by Google Programmable Search#328
Conversation
Adds an unlisted /search page (search.mdx, omitted from navigation.json) that renders a custom, sidebar-styled search box plus a Google CSE 'searchresults-only' element, driven via the CSE API. This keeps full control of the box styling and the URL (clean ?q=… instead of the widget's #gsc.* hash), matching the kubernetes.io/search approach. Details: - Results-only mode + our own input; queries run via element.execute(). - Results container is stashed on window and re-attached on mount so it survives MDX remounts (e.g. theme toggle). - ?q= is the source of truth: submit pushes history, popstate re-runs the query in place (dedup avoids destroying results on an unchanged param). - Custom .ch-cse* styling to match the sidebar search + an Enter keycap; .gsc*/.gs* result styling (titles, breadcrumbs, snippets, pagination) for light and dark, overriding the prose link rules. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 1adf921. Configure here.
| if (inputRef.current && inputRef.current.value !== q) inputRef.current.value = q; | ||
| if (q === lastQRef.current) return; | ||
| lastQRef.current = q; | ||
| if (q) execute(q); |
There was a problem hiding this comment.
Empty query leaves stale results
Medium Severity
The runQuery function's if (q) execute(q) check prevents clearing Google search results when the query becomes empty. This leaves stale results visible even though the input and URL reflect no active search.
Reviewed by Cursor Bugbot for commit 1adf921. Configure here.
| attributes: { enableHistory: false }, | ||
| }); | ||
| } | ||
| runQuery(initial); |
There was a problem hiding this comment.
Boot uses stale URL query
High Severity
The boot function initializes search with a stale initial query value, captured at mount. If the URL's ?q parameter changes before the Google CSE script loads, the deferred boot uses the old query, causing the search input and results to mismatch the current URL.
Reviewed by Cursor Bugbot for commit 1adf921. Configure here.


What
Adds an unlisted /search page (
search.mdx, deliberately omitted fromnavigation.json— reachable by URL, not shown in the sidebar) that renders our own search box plus a Google Programmable Search (CSE) results-only element, driven via the CSE API.This mirrors the kubernetes.io/search approach and gives us:
<input>, styled to match the sidebar search) — no fighting Google's nested-table DOM.?q=testinstead of the combined widget's#gsc.tab=0&gsc.q=…hash.How
parsetags: 'explicit'; the results element is rendered imperatively into a ref'd container.windowand re-attached on mount so it survives MDX remounts (e.g. a theme toggle would otherwise wipe Google's injected DOM).?q=is the source of truth: submit doespushState;popstate(back/forward) re-runs the query in place, with dedup so an unchanged param updates rather than destroys the results..ch-cse*styling (box + "Enter ↵" keycap) and.gsc*/.gs*result styling (titles, breadcrumbs, snippets, pagination, "Search … on Google") for light and dark, overriding the aggressive.proselink rules.Verification
Verified in real Chrome (light + dark): load
?q=…auto-runs, typed submit + Enter keycap work, back/forward updates results in place, and results persist across a theme toggle.🤖 Generated with Claude Code