Reputation: 1
I'm new to Keystone JS and NodeJS. This is the Part I totally do not understand; Example 'Post' as defined as 'Post', but there are no 'posts', but when I call/ search for Post, in example (and my practices), it was 'posts'. Exp:
keystone.set('nav', {
posts: ['posts', 'post-categories'],
enquiries: 'enquiries',
users: 'users',
});
Similar 'PostCategory' => 'post-categories', 'Enquiry'=>'enquiries' etc.
But when I making new Routes=>View for my custom post type, I must use:
locals.data = {
food: []
};
At this, its 'food' not 'foods'.
Upvotes: 0
Views: 105
Reputation: 3228
Keystone automatically uses the plural form of your model names in the Admin Panel, instead of its singular name. It's still referred to by its singular name (Food, PostCategory, Enquiry, etc.) throughout your code, but the admin panel uses the plural forms if referring to multiple documents of a model.
When working with local
, you can name the properties of that object anything you want. Doesn't have to be locals.data.food
; it can be whatever you want.
Also, the plural form of food is food. So nothing will change when using the plural form of a Food
model in your Admin Panel.
Upvotes: 0