Skip to content

Add pagination to search results

Sarah German requested to merge 1376-gps-load-more-results into main

What does this MR do and why?

Adds pagination for Google search results. This allows visitors to browse results beyond the first 10.

This MR also adds a GlLoadingIcon component to show a spinner while waiting for a response from the Google API.

Closes #1376 (closed)

Screenshots, screen recordings, or links to review app

Review app: https://1376-gps-load-more-results.docs.gitlab-review.app/search/?query=internet

Before After
image image

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. Compile the site with Google search:
SEARCH_BACKEND="google" GOOGLE_SEARCH_KEY="AIzaSyAUCkVNs7JsHYKISjVrVv1PGXg9WQr1MCQ" bundle exec nanoc compile
  1. Run a search that includes fewer than 10 results ("mongo" should do this) and verify no pager appears.
  2. Run a search that includes no results ("perjwoejfapsjdfaewojf" works) and verify no pager appears.
  3. Run a search with over 10 results ("git") and verify you can load results beyond the first set of 10.

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