Skip to content

Include recently-viewed pages in the search result panel

Sarah German requested to merge gps-recent-history into main

What does this MR do and why

Shows the user's last 3 visited pages in the Search dropdown before they enter a query.

This feature allows visitors to more easily retrace their steps on the site.

Closes #1566 (closed)

Screenshots, screen recordings, or links to review app

Before After
image image

How to set up and validate locally

Skip to step 3 if you're using the review app: https://gps-recent-history.docs.gitlab-review.app/

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. Run the site with Google search: https://gitlab.com/gitlab-org/gitlab-docs/-/blob/main/doc/search.md#local-build-with-google-programmable-search
  3. Browse around the site and verify the following:
  • "Recently viewed" does not appear in the search dropdown if you have not visited any pages yet.
  • "Recently viewed" includes your 3 last visited pages, excluding the homepage. No more than 3 should appear.
  • "Recently viewed" does not appear once you've started typing a search query (you should only see search results).
  • "Recently viewed" will reappear if you remove your search query from the form.

You can "start over" by deleting the pageHistory cookie with your browser dev tools. In Chrome, that's under Application > Storage > Cookies. 🍪

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