Integrate Search
Overview
Use this skill for search experience changes in this repo. Search behavior spans Gatsby page creation, the search page template, UI components, Algolia wiring, category labeling, and external search fallbacks.
Workflow
1) Locate the affected search layer
Common files:
gatsby/create-pages/create-search.tssrc/templates/DocSearchTemplate.tsxsrc/components/Search/index.tsxsrc/components/Search/Results.tsxsrc/shared/utils/algolia.tssrc/shared/utils/searchCategory.ts
Choose the correct layer before editing:
- Page route creation
- Search box interactions
- Result rendering and paging
- Category resolution
- Algolia client configuration
2) Preserve current locale and route assumptions
Search in this repo currently:
- creates
/search/ - navigates to
/search/?q=... - uses
gatsby-plugin-react-i18nexthelpers in UI - mixes onsite search with Google or Bing fallbacks
If you change search route shape or category prefixes, review i18n routing and resolveSearchCategory().
3) Update Algolia and category logic carefully
When touching search data wiring:
- Keep
GATSBY_ALGOLIA_APPLICATION_IDandGATSBY_ALGOLIA_API_KEYusage intact unless the task explicitly changes them - Reuse
normalizeSearchResultPath()andresolveSearchCategory()patterns - Update translation keys if new labels or UI strings are introduced
When adding a new top-level docs section, search categorization may need updates.
4) Review tracking and external search behavior
src/components/Search/index.tsx includes GTM events and Google/Bing fallbacks.
If you alter submit behavior, preserve or intentionally update:
- onsite vs external search selection
- query propagation to the search page
- GTM events
5) Validate
At minimum:
- Confirm the search route still resolves
- Confirm query string handling still works
- Confirm category chips still resolve correctly for representative URLs
- Run
yarn buildwhen feasible
Output Checklist
Report:
- Which search files changed
- Whether route, Algolia, category, or tracking behavior changed
- Any new translation keys or route-prefix dependencies
- Whether
yarn buildwas run