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

Feature: Option to ignore trailing slash or automatically append trailing slash #106

Open
Alexnortung opened this issue Jan 25, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@Alexnortung
Copy link
Collaborator

Feature request

Summary

I mostly use urls without trailing slashes, but some of the users of our strapi deployments may mistakenly set a trailing slash when creating a custom url alias. For example /about/, this mean I cannot fetch the entry by using /webtools/router?path=/about. From a user perspective /about and /about/ will be the same, this it would be nice to have an option such that they would resolve to the same and you could not have a page with both paths.

Why is it needed?

Some users are not the most technical and I also believe it is needed for "idiot proofing"

Suggested solution(s)

  1. No duplicates: whenever a path is updated or created, we should check whether or not the path exists with or without trailing slash.
  2. Enforce style: Whether or not the plugin should enforce using trailing slashes or no trailing slashes. This would mean that it should check the url path before saving and either remove or set trailing slashes.
@boazpoolman
Copy link
Member

I like suggested solution 2.
Definetly if this is something that can be controlled through plugin options by the end user.

@boazpoolman boazpoolman added the enhancement New feature or request label Jan 25, 2024
@Alexnortung
Copy link
Collaborator Author

For my use case I am using nextjs and nextjs seems to redirect you if you are using trailing slashes, which means the router never has a trailing slash. Because of this I would like it to be something that only the developer can change. (nextjs docs)

On the other hand, other frontends might just not care about this and then it would make sense that the end user could change this option.

So maybe this could be an option in the plugin configuration in config/plugins.ts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants