Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Layout super nav header: Correct URL for search form #4341

Merged
merged 1 commit into from
Oct 28, 2024
Merged

Conversation

csutter
Copy link
Contributor

@csutter csutter commented Oct 25, 2024

What

  • Point form at /search/all instead of /search to avoid most users going through an unnecessary 301 redirect
  • Use Rails's tag helper for more concise form code (in particular data attributes)

Why

Users currently get taken through an additional, unnecessary redirection when performing a search through the layout super nav's search form, as this points to the /search landing page instead of the actual site search page at /search/all. The former will just redirect to the latter if keywords are given:
image

While I was already here, using Rails's tag helper for the form tag means we have more concise and readable data attributes and don't have to manually convert to JSON.

@govuk-ci govuk-ci temporarily deployed to components-gem-pr-4341 October 25, 2024 14:03 Inactive
@govuk-ci govuk-ci temporarily deployed to components-gem-pr-4341 October 25, 2024 14:05 Inactive
@csutter csutter changed the title Layout super nav header: Improve search form Layout super nav header: Correct URL for search form Oct 25, 2024
@govuk-ci govuk-ci temporarily deployed to components-gem-pr-4341 October 25, 2024 14:09 Inactive
csutter added a commit to alphagov/frontend that referenced this pull request Oct 28, 2024
The form points to the wrong path for search - `/search` is a landing
page, not the actual all content finder (which is `/search/all`). This
means users searching from the homepage have to go through an
unnecessary redirection.

Also cleans up the form code by using Rails's tag helper.

See also: alphagov/govuk_publishing_components#4341
- Point form at `/search/all` instead of `/search` to avoid most users
  going through an unnecessary 301 redirect
- Use Rails's tag helper for more concise form code (in particular data
  attributes)
@govuk-ci govuk-ci temporarily deployed to components-gem-pr-4341 October 28, 2024 12:09 Inactive
@csutter csutter merged commit fdf2a14 into main Oct 28, 2024
12 checks passed
@csutter csutter deleted the search-improve branch October 28, 2024 14:10
@pezholio pezholio mentioned this pull request Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants