enRaiser enRaiser - 1 year ago 136
Node.js Question

How to replace object ID with alias in URL

I have just installed keystone.js and build basic site.
However I noticed that URL contains the mongoDB ID of length 24. that looks ugly.
Any Idea, how can I change it.


I want it to be like

Answer Source

We can use auto key of keystones

var Post = new keystone.List('Post', {
    autokey: { path: 'slug', from: 'title', unique: true },map: { name: 'title' },
    defaultSort: '-createdAt'
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download