Add URL parameters for search pagination and filters
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 |
---|---|
![]() |
![]() |
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.
-
Configure a local GitLab Docs environment: https://gitlab.com/gitlab-org/gitlab-docs/-/blob/main/doc/setup.md. -
Generate a build with Google search: https://gitlab.com/gitlab-org/gitlab-docs/-/blob/main/doc/search.md#local-build-with-google-programmable-search -
View the local site: make view
-
On the homepage or an interior content page, type in a search query and hit Enter to go to the full results page -
Verify your search query comes in as a URL param (e.g, /search?q=cats
) and a search has been run for that term -
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
). -
Use the pager at the bottom of the result list to view subsequent result pages; you should see the page
parameter change accordingly. -
Verify you can visit a search result link with URL parameters on it and see the results list update to reflect those. Examples:
- https://gps-results-maintain-state.docs.gitlab-review.app/search/?q=cats&page=1&filters=develop
- https://gps-results-maintain-state.docs.gitlab-review.app/search/?q=docker&page=4
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.
-
I have evaluated the MR acceptance checklist for this merge request.
Edited by Sarah German