Skip to content

Add URL parameters for search pagination and filters

Sarah German requested to merge gps-results-maintain-state into main

What does this MR do and why?

Adds URL parameters to the search results page when users select filters or use pagination. This allows visitors to more easily retrace their steps and share more specific search result page links.

Closes #1606 (closed)

Screenshots, screen recordings, or links to review app

Review app: https://gps-results-maintain-state.docs.gitlab-review.app/search/?q=AI&page=2&filters=administer%2Cdevelop

Before After
image image

How to set up and validate locally

Skip to step 4 if you're testing in the review app (which should work fine).

Numbered steps to set up and validate the change are strongly suggested.

  1. Configure a local GitLab Docs environment: https://gitlab.com/gitlab-org/gitlab-docs/-/blob/main/doc/setup.md.
  2. Generate a build with Google search: https://gitlab.com/gitlab-org/gitlab-docs/-/blob/main/doc/search.md#local-build-with-google-programmable-search
  3. View the local site: make view
  4. On the homepage or an interior content page, type in a search query and hit Enter to go to the full results page
  5. Verify your search query comes in as a URL param (e.g, /search?q=cats) and a search has been run for that term
  6. Select some "Filter by" options; results should filter accordingly, and you should see the filters URL parameter change. Multiple values should be separated by an URL-encoded comma (%2C).
  7. Use the pager at the bottom of the result list to view subsequent result pages; you should see the page parameter change accordingly.
  8. Verify you can visit a search result link with URL parameters on it and see the results list update to reflect those. Examples:

Merge request acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Sarah German

Merge request reports