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
Numeric slugs #4770
Comments
@d-m- IIRC they are not allowed since they conflict with the id's that can also be used to access content. |
The frontend router first tries to fetch by slug and falls back to IDs, Would a PR allowing numeric slugs if an option is set in contenttypes.yml have any chance of getting merged? |
@d-m- I solved a similar problem with a custom controller(I needed this feature to make a news archive available by dates presented in url). You can make your own route like "archive" (or override a route for your entity) and process those URLs in controller assigned to this route. |
@d-m- Perhaps conflict is the wrong word, but it would make things slightly less predictable. Any record can be accessed by both it's slug and it's ID, so a user might make a record with the slug 2016 and later expect to be able to access a record with the ID 2016 using the ID, which would then return the record with the slug 2016. Whether a change would be accepted I don't really know (I don't really make those calls)... If it was changed I'd prefer it to be an option rather than the default, since it might screw with some existing sites otherwise. It has been discussed previously in #4327 and #3001 though, so clearly some people want this to be an option. |
@C4Grey Thanks, this is basically what I'm doing right now. However, I think that writing a controller for this is more complicated than necessary, especially since this probably is the expected behavior. I opened a small PR that makes this an option. |
I concur with @d-m- and our use case is a conference website that already uses /YYYY (e.g /2016) as the entry for the event year. Having to write a controller for this is indeed more complicated than necessary. If you allow this instead and clarify in the docs the potential conflict that may exist with ID (in edge cases, not generally, if I'm not mistaken), then it's best of both worlds for everybody, isn't-it? |
Done in #4784 |
This has currently only been implemented in deprecated code, so not done. |
Adding a blocker tag too |
Are the methods that will replace getUri and parseTextQuery already implemented? In any case I could write unittests for the option, I guess this would be a good start. |
It's a whole different ball-game in Thoughts @rossriley ? |
There's no rush, we haven't switched over to the new parser yet, so we can address this ready for 3.1 but it will need doing since the parser is going to be 100% backwards compatible with the old one. |
I can't find any PR or commit saying we implemented this is non-deprecated code, so it seems that while it's working the issue that @CarsonF pointed out in #4770 (comment) is still an issue, so I'm reopening, and happy to be proven wrong :) |
@SahAssar Good point! Thank you. |
Bumping to 3.3+ as we're in critical bug fix only mode for 3.2 now. |
This issue has been automatically marked as stale because it has not had recent activity. Maybe this issue has been fixed in a recent release, or perhaps it is not affecting a lot of people? |
This one is still not in new storage, so still relevant IIRC. |
This issue has been automatically marked as stale because it has not had recent activity. Maybe this issue has been fixed in a recent release, or perhaps it is not affecting a lot of people? |
Still only implemented in deprecated code, but I'm guessing this might all change with v4. Keeping open for now. |
This issue has been automatically marked as stale because it has not had recent activity. Maybe this issue has been fixed in a recent release, or perhaps it is not affecting a lot of people? |
Currently numerical slugs are not allowed, although they might be useful for some
custom contenttypes (say, yearly events, with URL "/event/2016").
Is there any reason not to allow them?
I did not encounter any problems after commenting out
https://github.com/bolt/bolt/blob/master/src/Legacy/Storage.php#L2836-L2839.
The text was updated successfully, but these errors were encountered: