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

Updated logic to handle multilingual internal path redirects. #215

Merged
merged 13 commits into from
Feb 28, 2024

Conversation

kepol
Copy link
Contributor

@kepol kepol commented Jan 9, 2024

See details in these Drupal.org issues:

https://www.drupal.org/project/quantcdn/issues/3343237
https://www.drupal.org/project/quantcdn/issues/3413036
https://www.drupal.org/project/quantcdn/issues/3343245

Tested thoroughly with nodes/terms:

  1. Node - English only, alias and no alias, published and unpublished, including content type with translation disabled
  2. Node - Spanish only, alias and no alias, published and unpublished
  3. Node - English and Spanish, same/different aliases and no alias, published and unpublished
  4. Term - English only, alias and no alias, published and unpublished
  5. Term - Spanish only, alias and no alias, published and unpublished
  6. Term - English and Spanish, same/different aliases and no alias, published and unpublished

The only thing I noticed is that content is not created if it's unpublished to start with (though the canonical redirects are created). This is a separate issue that isn't very pressing.

See my chicken scratches and the comments below for all the permutations tested:

quant-multingual-redirects-node-testing

quant-multingual-redirects-term-testing

@kepol kepol changed the title Updated logic to handle multilingual canonicals. Updated logic to handle multilingual canonical redirects. Jan 9, 2024
@kepol kepol self-assigned this Jan 9, 2024
@kepol kepol added bug Something isn't working enhancement New feature or request Drupal 8 / 9 / 10 needs review labels Jan 9, 2024
@kepol
Copy link
Contributor Author

kepol commented Jan 9, 2024

I'm still testing terms so moving this to draft for now.

@kepol kepol marked this pull request as draft January 9, 2024 23:40
@kepol kepol changed the title Updated logic to handle multilingual canonical redirects. DRAFT Updated logic to handle multilingual canonical redirects. Jan 9, 2024
@kepol
Copy link
Contributor Author

kepol commented Jan 21, 2024

Nodes are working as expected but still need to test taxonomy terms.

@kepol
Copy link
Contributor Author

kepol commented Jan 21, 2024

Did extensive testing for nodes and terms today and a couple of weeks ago and it's working as expected:

Screenshot 2024-01-21 at 12 26 19 PM

Screenshot 2024-01-21 at 12 27 59 PM

Screenshot 2024-01-21 at 12 28 21 PM

@kepol kepol marked this pull request as ready for review January 21, 2024 20:35
@kepol kepol changed the title DRAFT Updated logic to handle multilingual canonical redirects. Updated logic to handle multilingual canonical redirects. Jan 21, 2024
Copy link
Contributor

@steveworley steveworley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good, just a minor question on using an entity method.

src/Seed.php Outdated Show resolved Hide resolved
@kepol
Copy link
Contributor Author

kepol commented Jan 30, 2024

Tested seeding all nodes/terms and manually editing one node/term and everything seems fine.

@kepol kepol dismissed steveworley’s stale review January 30, 2024 05:09

Changes were made based on feedback

@kepol
Copy link
Contributor Author

kepol commented Jan 30, 2024

@steveworley ready for re-review, thanks

@kepol
Copy link
Contributor Author

kepol commented Jan 30, 2024

I added Utility::getCanonicalUrl and refactored.

@kepol
Copy link
Contributor Author

kepol commented Jan 30, 2024

Not sure why it's complaining about that use statement as it's needed.

@kepol
Copy link
Contributor Author

kepol commented Jan 30, 2024

Oh… of course, same directory… I’ll fix tomorrow

Copy link
Contributor

@steveworley steveworley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving, code looks good — with the @todo to simplifier the logic in handleInternalPathRedirects I think we could use the plugin system and contain each logic piece in a separate file so that we can more easily test and repeat this. Maybe we can create a backlog ticket for that, low priority when we have time :D

@kepol kepol changed the title Updated logic to handle multilingual canonical redirects. Updated logic to handle multilingual internal path redirects. Feb 28, 2024
@kepol kepol merged commit de5a9e6 into 8.x-1.x Feb 28, 2024
2 checks passed
@kepol
Copy link
Contributor Author

kepol commented Feb 29, 2024

Added backlog ticket per Steve's comment:

https://www.drupal.org/project/quantcdn/issues/3424522

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Drupal 8 / 9 / 10 enhancement New feature or request multilingual
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants