Scroll to search query on result pages
What does this MR do and why?
This MR adds a ?query=yourTerm
string to the end of search result URLs for specific pages. When you visit a page linked from your search results, if there's a heading on the page that matches the URL query string, we scroll you down to it
For example, if you search for include
and click the .gitlab-ci-yml keyword reference
page from the result list, you should land down here: https://gps-search-result-scroll.docs.gitlab-review.app/ee/ci/yaml/?query=include
For now we are limiting this to only the CI keywords page.
See #1692 (closed)
Screenshots, screen recordings, or links to review app
Try searching for a CI keyword ("needs" "artifact" "cache" etc) on the review app: https://gps-search-result-scroll.docs.gitlab-review.app/
How to set up and validate locally
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. -
Compile the site to use Google search, and run a search for a CI keyword. (This feature will also work with Lunr, but Lunr rarely returns the CI keywords page as a result.) -
Click on the CI keywords page in the result list. -
If the page includes a heading that matches your search query, you should be scrolled down to that heading. -
If you click on a result that is not the CI keywords page, there will not be a ?query=yourTerm
in the URL, and no auto-scrolling on the result page.
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.