-
-
Notifications
You must be signed in to change notification settings - Fork 811
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
Omitting singular_name in Contenttypes breaks URL generation during Record creation #823
Comments
I've bumped into this once or twice as well. Although, mostly with "news" or "media".. I've never tried to create a contenttype for "sheep". ;-) I'm not sure yet how we should fix this. The reason that Bolt complains about it, is to prevent the routes from getting confused: http://example.org/pages - an overview listing of pages If we allow the singular and plural version to be the same, these routes would get messed up. To be specific: Suggestions how we should fix this? |
All manner of laughter and further jokes went through my head reading this late on a Friday afternoon! I'm only a day into reading Bolt documentation and code, so an immediate suggestion is beyond me. Especially considering that the above is also already mentioned in the "Templates and routing" document page (it's Friday) ;-) Having said that and further thinking out aloud, contentlink and contentlisting theoretically should still somehow route separately as they may be similar, but not identical. But I was a victim of reading the WordPress codebase, so I am still recovering. However, others might have better insight. |
I also had this problem (with german words). I "solved" it by using the english words for the contentypes and some german routing that translated to the correspondending datatype. In another case I used "news" and "newsitem". But I don't know why this could confuse the routes anyway. Without knowing anything about the internals of routing some simple regex would solve the problem: http://example.org/sheep -> Simply said, if the URL ends with the contenttype then listing is selected and if the contenttype is followed by an "selector" the selected item is displayed. Am I overseeing here something? |
Why don't we think it "rest" like PS: |
I've looked into this a bit more.. If we decide that we will allow 'slug' and 'singular_slug' to be the same, we need to fix the routing. Not just for the frontend, but also for the backend. So, it's slightly more work than just fixing routing.yml, but it should be do-able. |
I've bumped into this once or twice as well. Although, mostly with "news" or "media".. I've never tried to create a contenttype for "sheep". ;-) @bobdenotter : how did you manage to solve this problem ? And there is another problem : we don't have any hand on the "plural_name". (or maybe yes and I didn't see it yet ! :) ). And for some words in french : Is there a way to fix theses two problems ? |
Well, turns out this was relatively easy to fix. With the above changes, you can now have a slug and singular_slug that are the same. Like 'news'. Or 'sheep'. :-) Links like @WilliamVercken I think your other problem is more related to multi-lingual content than the actual contenttypes, right? You can define the slug seperate from the name, maybe that helps: cafes:
slug: cafes
name: Cafés
singular_slug: cafe
singular_name: Café |
Oh, I didn't know that there was that option !
? |
Yes, you can do that now (after the changes i committed earlier this afternoon. ;-) ) |
Great news/sheep ! |
Excellent, thank you yet again @bobdenotter |
Great! |
I can not tell you how much I truly love this idea, @rarila! |
I, too, am very happy that this is now the case. I can finally restructure my URL tree. Thanks, @bobdenotter! |
Some words (I can only speak for how they are used in English), have the same plural as singular. e.g. "multimedia", "news", "sheep" & "moose".
Creating a content such as:
Will give the error:
Whereas, if the singular_name variable is omitted, a blank URL stub is generated when a new Record is created with that Contenttype.
The text was updated successfully, but these errors were encountered: