-
-
Notifications
You must be signed in to change notification settings - Fork 588
[6.x] Normalize and configure trailing slashes in URLs #11840
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
Conversation
… of a trailing slash 😅
@jesseleite @jasonvarga whats the status on this one? Would love to see it. |
Will be reviewed soon |
- Write a test for when home is an entry that it shouldn't be marked as is_parent when on any other page. The change to Strucure.php fixes this. - Edit the existing test (where home is a plain non-entry link) so that home shouldn't be marked as parent on any page, except if you're on a page that is actually a child.
@jasonvarga is there perhaps anything I can do to help speed up this review? This PR was created almost 2 months ago. |
This PR is targeting Statamic 6, which isn't out yet. It'll be merged before v6 is released. |
@duncanmcclean it appears to be in progress for quite a long time. Perhaps you have a solution for a site we want to migrate to statamic (v5) at this point? Changing a 10y/o site trailing slash to redirect them to without is a huge SEO risk. |
Hey, all! Will this be merged in to review as part of the alphas? Or will this be in a future beta release? Was hoping to get in some SEO Pro testing, but I think this is required for that. |
Not sure about timing, but it'll definitely be merged before we tag a stable release. |
This PR adds the ability to enforce trailing slashes in URLs via
URL::enforceTrailingSlashes()
, which has been asked for a fair bit.The idea is to make Statamic normalize trailing slashes in URLs (ie. remove them by default, or add them if the above is configured), while respecting URL query and fragment at the end of any given URL. To opt into this functionality for any URL output, simply wrap the URL with
URL::tidy($url)
.In fact, all methods on the
URL
facade should now return tidied output with normalized trailing slashes where relevant. This PR kind of turned into a big URL facade overhaul/cleanup for v6.Related Issues:
statamic/ideas#1293
statamic/ssg#65
statamic/seo-pro#387
Related PRs:
statamic/ssg#203
statamic/seo-pro#393