Skip to content

Conversation

@rosieyohannan
Copy link
Contributor

@rosieyohannan rosieyohannan commented Dec 9, 2025

Add URL Query Parameter Support for Search

Summary

Adds URL query parameter support to the Algolia search integration, allowing search state to be passed via URL and fully
shareable search results.

Motivation

Enable integration between the CircleCI product app and docs site by allowing search terms to be passed as URL parameters.

Users can now be redirected from the product app to the docs with a pre-populated search query.

Changes

URL Parameters Added:

  • ?q= - Search query term
  • ?page= - Pagination page number (1-indexed in URL, only added when > 1)
  • ?component= - Component filter (only added when not "All")

Features Implemented:

  1. URL Reading on Page Load - Automatically reads search parameters from URL and displays results
  2. URL Updates During Search - Updates URL as users search, paginate, or filter by component
  3. Browser History Integration - Back/forward buttons navigate through search history using popstate event listener
  4. URL Cleanup - Removes search parameters when search is cleared

Example URLs:

  • ?q=docker
  • ?q=docker&page=2
  • ?q=docker&component=server
  • ?q=docker&component=server&page=3

Implementation Notes

  • Uses window.history.pushState() to update URLs without page reload
  • Each search/pagination/filter creates a browser history entry for intuitive navigation

@rosieyohannan rosieyohannan requested review from a team as code owners December 9, 2025 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants