1

I am new in KeystoneJS and was trying to add a new navigation tab in the admin panel , so for the same i made changes in the keystone.js file and added the required navigation tab in the code

"keystone.set('nav', { .... });"

but after making changes in it and then running the code i get an error Unknown keystone list "newTab"

  • Why is this marked down without a comment? It seems most of these Admin customization questions are. There isn't a clear answer already available so I DON'T believe the question should be penalized... I mean.. yes the correct syntax is in the docs but clearly some users can't find it. – Quinn Keaveney Jul 05 '16 at 01:38

1 Answers1

2

I don't know the name of your model, but the correct syntax is:

keystone.set('nav', {
    '<tab-name>': '<modelname>'
});

Where tab name can be anything, and modelname should be either the exact (case sensitive!) same name as your model name or a lower case plural version of it.

For example:
Your model: Artwork.js

var Artwork = new keystone.List('Artwork', { ... });

Your navigation definition:

keystone.set('nav', {
    'art': 'Artwork'
});

OR

keystone.set('nav', {
    'art': 'artworks'
});
JasperV
  • 656
  • 1
  • 9
  • 19
  • I updated to the lower case plural version of the model and it fixed bug, but I'm curious why it has to be plural version? @JasperV – Yao Li Jul 09 '17 at 19:06
  • @Yao: As far as I know, it is a Mongoose thing: https://stackoverflow.com/questions/10547118/why-does-mongoose-always-add-an-s-to-the-end-of-my-collection-name Keystone supports it as well... Although you can also override the collection name, see this comment on the github page: https://github.com/keystonejs/keystone/issues/292#issuecomment-40897315 – JasperV Jul 11 '17 at 06:06