-
Notifications
You must be signed in to change notification settings - Fork 882
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
canonical-presenter hook removes final slash in URL if URL contains a period #21371
Comments
Hi @MatthewSbar Thanks for using the Yoast SEO plugin and also for creating the issue. I tried to reproduce the issue by creating a URL with a period within the slug. Unfortunately, I noticed that WordPress is changing the period to - hypen automatically. So, is there any way to replicate this, as WordPress seems to be not allowing the period in the slug by default? We look forward to hearing from you. |
I suppose I should clarify that these aren't "normal" WordPress pages, I'm using PHP with a rewrite rule to load a page template, then using a bunch of PHP to overwrite Yoast's metadata with my own. It's a convoluted setup that's required for my use-case of having a series of pages populated by an API living within WordPress. I think the amount of code I'd have to share to have you reproduce is a bit excessive and certainly I'm the only person in the world who will have this issue, so, you can probably close it. I worked around it by just asking the API provider to not-use URLs with periods in them which thankfully worked. If you really want to reproduce, you can do something like this in a plugin (some of this might need tweaking since I renamed/removed as much as possible, your mileage may vary)
You'll also need a template file in your theme folder like so
Then don't forget to flush rewrite rules. :) If you jump through all these hoops you should be able to visit |
Hi @MatthewSbar Thanks for replying and letting us know you found a fix for the issue. Since it won't occur with the normal WordPress setup, I'm closing this issue for now as we work on the high-priority issues first. If more people report this in the future, we will reopen it. |
Please give us a description of what happened
I have pages where I need to override the canonical - if I have a URL without any periods whatsoever, everything works fine, but if my URL includes a period, the final slash in the URL gets removed for some reason
To Reproduce
Step-by-step reproduction instructions
Add a filter like so (assuming the site is https://www.yubico.com)
Expected results
Actual results
Screenshots, screen recording, code snippet
If possible, please provide a screenshot, a screen recording or a code snippet which demonstrates the bug.
Technical info
Used versions
The text was updated successfully, but these errors were encountered: