Skip to content

Draft: Add a versions selector for search results

Sarah German requested to merge sarahg/gps-versions into main

What does this MR do and why?

Adds the Versions menu to the Search page, and rewrites result links to point to the selected version.

Closes #1371 (closed)

Screenshots, screen recordings, or links to review app

Review app: https://sarahg-gps-versions.docs.gitlab-review.app/search/?query=rake%20task

How to set up and validate locally

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. Check out this branch and compile the site with a Google search backend: make clean && GOOGLE_SEARCH_KEY="AIzaSyAUCkVNs7JsHYKISjVrVv1PGXg9WQr1MCQ" SEARCH_BACKEND="google" bundle exec nanoc compile
  3. Start the web server (bundle exec nanoc view) and run a search.
  4. Links should be relative (pointing to your local copy) and not include any version prefixes.
  5. This is clunky, but the best way I can think of to manually test an old version: modify layouts/head.html to use <meta name="gitlab-docs-version" content="15.9"> instead of <meta name="gitlab-docs-version" content="<%= site_version %>">
  6. Re-compile the site: make clean && GOOGLE_SEARCH_KEY="AIzaSyAUCkVNs7JsHYKISjVrVv1PGXg9WQr1MCQ" SEARCH_BACKEND="google" bundle exec nanoc compile
  7. Run a search and verify that links point to pages on docs.gitlab.com/15.9.

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