Keystone-classic: Add nav-links for custom pages

Created on 3 Sep 2015  路  7Comments  路  Source: keystonejs/keystone-classic

I have gotten around to understand some of the basic ways to configure keystone. For example, creating models, adding routes, middleware and changing which columns appear in Admin UI. They all work pretty smooth. :)

However, what has been bugging me for the past few days is that I am able to create my custom routes and templates but unable to provide any "links" to those routes, either in the homepage or the header navigation. The header navigation allows you to add only keystone lists.

How do I add a non-keystone list in my navigation panel (say an About Us page) and at the same time have the Admin UI enabled for the keystone lists?

Most helpful comment

@r3wt @ifiok I just found a workaround

keystone.set('nav', {
    venues: 'venues',
    customers: 'customers',
    users: 'users',
    'reservations': [
        {
            label: 'Reservations',
            key: 'reservations',
            path: '/reservations'
        }
    ]
});

In this case, this will give me a menu item called 'Reservations' leading me to '/reservations'. You HAVE to wrap your menu item with an array... this is probably a bug that should be fixed at some point.

All 7 comments

Hi @ajayvishwanath you can add any links you want to the navigation by adding an object instead of a string:

keystone.set( "nav", {
  "content": [
    "posts",
    "post-categories",
    "enquiries",
    {
      label: "reports",
      key: "reports",
      path: "/api/reports"
    },
  ]
});

Hey, thanks for the reply!

I tried and it works pretty well. Thanks.

this no longer works. whats the new way to work around this issue?

@r3wt Did you find a workaround for this?

@r3wt @ifiok I just found a workaround

keystone.set('nav', {
    venues: 'venues',
    customers: 'customers',
    users: 'users',
    'reservations': [
        {
            label: 'Reservations',
            key: 'reservations',
            path: '/reservations'
        }
    ]
});

In this case, this will give me a menu item called 'Reservations' leading me to '/reservations'. You HAVE to wrap your menu item with an array... this is probably a bug that should be fixed at some point.

@r3wt I have a question

The menu configuration is clear. It works for me. My question is how can i put a custom admin page template behind the route without going out of /keystone admin.

For example i want to create a "/keystone/dashboard" page but obviously there is no schema or model for the dashboard as i want to display custom information, which can not be strictly connected to one resource.

Does anyone know how to do that?

@zoltanradics I really doubt you can do that without modifying the keystonejs module. I did some research and it seems doable in v4.0.0 but not the in v0.3.x

Was this page helpful?
0 / 5 - 0 ratings

Related issues

javierpelozo picture javierpelozo  路  5Comments

josephg picture josephg  路  4Comments

useralive003 picture useralive003  路  5Comments

schybo picture schybo  路  3Comments

jacqueslareau picture jacqueslareau  路  5Comments