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

Numeric slugs #4770

Closed
d-m- opened this issue Jan 29, 2016 · 21 comments
Closed

Numeric slugs #4770

d-m- opened this issue Jan 29, 2016 · 21 comments
Assignees
Labels
enhancement RFC Request For Comments stale Stale issues & PRs flagged for closing

Comments

@d-m-
Copy link
Contributor

d-m- commented Jan 29, 2016

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.

@SahAssar
Copy link
Contributor

@d-m- IIRC they are not allowed since they conflict with the id's that can also be used to access content.

@d-m-
Copy link
Contributor Author

d-m- commented Jan 29, 2016

The frontend router first tries to fetch by slug and falls back to IDs,
{{ record.link }} uses slugs, and the editlinks use only IDs, as far as I know...
So the only conflict I could think of would be if someone uses a theme with explicit
ID-links.

Would a PR allowing numeric slugs if an option is set in contenttypes.yml have any chance of getting merged?

@Serhii-the-Dev
Copy link

@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.

@SahAssar
Copy link
Contributor

@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.

@SahAssar SahAssar added the RFC Request For Comments label Jan 30, 2016
@d-m-
Copy link
Contributor Author

d-m- commented Jan 31, 2016

@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 guess most users don't use ID routes and and it should be fairly simple for developers building a site to prevent conflicts.

I opened a small PR that makes this an option.

@padawan
Copy link
Contributor

padawan commented Feb 6, 2016

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?

@GwendolenLynch
Copy link
Contributor

Done in #4784

@CarsonF
Copy link
Member

CarsonF commented Feb 10, 2016

This has currently only been implemented in deprecated code, so not done.

@GwendolenLynch
Copy link
Contributor

Adding a blocker tag too

@d-m-
Copy link
Contributor Author

d-m- commented Feb 10, 2016

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.

@GwendolenLynch
Copy link
Contributor

It's a whole different ball-game in master now.

Thoughts @rossriley ?

@rossriley
Copy link
Contributor

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.

@GwendolenLynch GwendolenLynch modified the milestones: Bolt 3.1 - Feature release, Bolt 3.2 - Feature release Jul 25, 2016
@bobdenotter
Copy link
Member

Works in 3.2, closing!

screen shot 2016-10-01 at 15 34 34

@SahAssar
Copy link
Contributor

SahAssar commented Oct 2, 2016

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 SahAssar reopened this Oct 2, 2016
@bobdenotter
Copy link
Member

@SahAssar Good point! Thank you.

@GwendolenLynch
Copy link
Contributor

Bumping to 3.3+ as we're in critical bug fix only mode for 3.2 now.

@GwendolenLynch GwendolenLynch modified the milestones: Bolt 3.3 - Feature release, Bolt 3.2 - Feature release Oct 8, 2016
@GwendolenLynch GwendolenLynch modified the milestones: Bolt 3.5 - Feature release, Bolt 3.3 - Feature release Feb 24, 2017
@stale
Copy link

stale bot commented Nov 20, 2017

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?
It will be closed if no further activity occurs, because we like to keep the issue queue concise and actual.
If you think this issue is still relevant, please let us know. Especially if you’d like to help fix the issue, either by helping us pinpointing the cause of a bug, or in implementing a fix or new feature.

@stale stale bot added the stale Stale issues & PRs flagged for closing label Nov 20, 2017
@SahAssar
Copy link
Contributor

This one is still not in new storage, so still relevant IIRC.

@stale stale bot removed the stale Stale issues & PRs flagged for closing label Nov 20, 2017
@stale
Copy link

stale bot commented Jan 19, 2018

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?
It will be closed if no further activity occurs, because we like to keep the issue queue concise and actual.
If you think this issue is still relevant, please let us know. Especially if you’d like to help resolve the issue, either by helping us pinpointing the cause of a bug, or in implementing a fix or new feature.

@stale stale bot added the stale Stale issues & PRs flagged for closing label Jan 19, 2018
@stale stale bot closed this as completed Jan 26, 2018
@SahAssar
Copy link
Contributor

Still only implemented in deprecated code, but I'm guessing this might all change with v4. Keeping open for now.

@SahAssar SahAssar reopened this Jan 26, 2018
@stale stale bot removed the stale Stale issues & PRs flagged for closing label Jan 26, 2018
@rossriley rossriley self-assigned this Feb 25, 2018
@bobdenotter bobdenotter removed this from the Bolt 3.5 - Feature release milestone Mar 27, 2018
@stale
Copy link

stale bot commented May 26, 2018

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?
It will be closed if no further activity occurs, because we like to keep the issue queue concise and actual.
If you think this issue is still relevant, please let us know. Especially if you’d like to help resolve the issue, either by helping us pinpointing the cause of a bug, or in implementing a fix or new feature.

@stale stale bot added the stale Stale issues & PRs flagged for closing label May 26, 2018
@stale stale bot closed this as completed Jun 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement RFC Request For Comments stale Stale issues & PRs flagged for closing
Projects
None yet
Development

No branches or pull requests

8 participants