Fix search form styling for older versions
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 |
---|---|
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. -
Check out this branch -
Compile and view the site: make view
-
Verify search appears styled with a border on the homepage, and no border on interior pages (like docs.gitlab.com) -
Move the site into a subdirectory: mv public 16.0 && mkdir public && mv 16.0 public/
-
Run the normalize-links script: ./scripts/normalize-links.sh public/16.0 16.0
-
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.
-
I have evaluated the MR acceptance checklist for this merge request.