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

Redirect language URLs with non-translated slugs #6601

Merged
merged 2 commits into from
Aug 13, 2024

Conversation

distantnative
Copy link
Member

@distantnative distantnative commented Aug 11, 2024

Description

Summary of changes

  • If a secondary-language page gets accessed with a URL that contains untranslated slugs (for which a translation exists), the request is redirected to the fully translated URL (302 redirect)

Reasoning

To make those pages only available under the main (full- translated) URL and not several ones (with untranslated slug parts).

Additional context

In #3550 (comment) under "Complex example", @lukasbestle asks for an additional unit test where the translated slug of a page is the same as the untranslated slug of another page. This unit test is not included here as it would fail. However, this behavior is also different before this PR: if a translated slug is the same as the untranslated slug of a different page, our router will return the different page. Moreover, our page rules also prevent creating a translated slug that matches an existing untranslated slug. This is why I didn't include this aspect in this PR. To me this seems as a much larger change to be discussed, while this PR implements the solution for #3550 based on the existing rules.

Changelog

Fixes

Ready?

  • In-code documentation (wherever needed)
  • Unit tests for fixed bug/feature
  • Tests and CI checks all pass

For review team

  • Add lab and/or sandbox examples (wherever helpful)
  • Add changes & docs to release notes draft in Notion

@distantnative distantnative added the type: bug 🐛 Is a bug; fixes a bug label Aug 11, 2024
@distantnative distantnative added this to the 4.4.0 milestone Aug 11, 2024
@distantnative distantnative self-assigned this Aug 11, 2024
@distantnative distantnative force-pushed the fix/3550-redirect-untranslated-slug branch from 20d0ed0 to 7cf74b5 Compare August 11, 2024 13:12
@distantnative distantnative force-pushed the fix/3550-redirect-untranslated-slug branch from 7cf74b5 to 8e8f9e5 Compare August 11, 2024 13:19
@distantnative distantnative marked this pull request as ready for review August 11, 2024 13:25
@distantnative distantnative requested a review from a team August 11, 2024 13:25
@distantnative distantnative force-pushed the fix/3550-redirect-untranslated-slug branch from c50d212 to d2555de Compare August 12, 2024 17:54
@bastianallgeier bastianallgeier merged commit 36f9a8c into develop-minor Aug 13, 2024
12 checks passed
@bastianallgeier bastianallgeier deleted the fix/3550-redirect-untranslated-slug branch August 13, 2024 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug 🐛 Is a bug; fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Redirect requests to default language URI in secondary languages to the custom secondary language slug
2 participants