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

Add multilingual support for Canonical URL Notation Tool #693

Open
sybrew opened this issue Nov 16, 2024 · 2 comments
Open

Add multilingual support for Canonical URL Notation Tool #693

sybrew opened this issue Nov 16, 2024 · 2 comments

Comments

@sybrew
Copy link
Owner

sybrew commented Nov 16, 2024

The new Canonical URL Notation Tool does not appear to support Polylang.

What we get: example.com/path-to-translated-page/
What we want: example.com/lang/path-to-translated-page/

Instead of transforming $wp_rewrite->front, it modifies the home_url() callback.
WPML is in the same boat.

This is also why #675 is problematic.

We need to find a way to extract their "root."

I'd love to have this resolved before the final release, but I'm only halfway through the code review.
And since this is only a visual issue (which I'm sure many will complain about), it's not a blocker.

@sybrew
Copy link
Owner Author

sybrew commented Nov 16, 2024

We may want to temporarily resort to the old behavior of displaying the canonical URL on translated pages by setting allowReferenceChange to false.

The value of defaultCanonical appears correct for both WPML and Polylang, which will then be locked in place.

sybrew added a commit that referenced this issue Nov 18, 2024
@sybrew
Copy link
Owner Author

sybrew commented Nov 18, 2024

In f3b5de5, I added a check for allowCanonicalURLNotationTool. It'll be set when TSF detects a translation plugin, and when set, the Canonical URL Notation Tool will be disabled.

In turn, users will see the URL WordPress predicts, which won't update until you save the post or term and may display a less useful GUID when creating the post.

This temporary hack short-circuits the result to the original placeholder. All other processing still takes place, which is inefficient and not up to my standards. Still, this change allows me to delay the fix to a later update, buying me time to find a proper solution.

@sybrew sybrew modified the milestones: 5.1.0, 5.1.1 Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant