Skip to content

Fix search form styling for older versions

Sarah German requested to merge gps-border-style-fix into main

What does this MR do and why?

The search form on the homepage of the 16.0 site is missing its border: https://docs.gitlab.com/16.0/

This happened due to the logic for adding a border or not, which checks to see if we're on the homepage. This check was too simple in that it used the URL to determine if we were on a homepage; this failed when the homepage moved from docs.gitlab.com to docs.gitlab.com/xx.yy.

This MR adds a data attribute to the <body> tag on the homepage template, which will always exist regardless of what URL you're viewing the site on, and only on the homepage. We then check that attribute instead of the URL when styling the form.

Screenshots, screen recordings, or links to review app

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. Check out this branch
  3. Compile and view the site: make view
  4. Verify search appears styled with a border on the homepage, and no border on interior pages (like docs.gitlab.com)
  5. Move the site into a subdirectory: mv public 16.0 && mkdir public && mv 16.0 public/
  6. Run the normalize-links script: ./scripts/normalize-links.sh public/16.0 16.0
  7. Verify the search forms have the proper borders when viewing the site here: http://localhost:3000/16.0

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.

Merge request reports