Change Slug from ID to Title

Is there a way to change the slug of a single/details page? I have a section for events and when linking it does not create the slug for the event but just gives the id. Is there something I am missing in the docs?

@nicholastillman The software should auto-slug if you’ve got a field named name or title. Other than that, there’s currently no way to override the slug creation. That said, the slugs are mostly ignored by the route parser, so you can put anything in the slug portion of the URL, and it should work. For example, /offices/my-office-1 and /offices/myoffice-1 will resolve to the same location.

thanks @scott. Also, side question, when self hosting, the git repo says set the NODE_ENVIRONMENT to production with SECRETKEY. What file do I add this to?

thanks again

@nicholastillman There’s a couple of ways you can do this. The first is to create a .env file in the root of your site’s directory, and put the environment variables in there. e.g.,


The other is to prepend the variables to the script you’re using to start your server. e.g.,

NODE_ENV=production SECRET_KEY=abc123 /script/to/run/server

Hope that helps.

thanks @scott. For some reason cannot keep vapid running once I logout of SSH. Also, I planned on just using sqlite as the site I have developed is simple. Any tips on this? My host is a cloud/VPS - Hostwinds. managed

@nicholastillman you need to look at running something like PM2 to keep it running outside the ssh session, @cmall has a good tutorial that includes using pm2

@Hadr619 thanks for the tip. I am using Hostwinds VPS Centos. I noticed that @cmaill is using digital ocean.

I’m not too familiar with Hostwinds, but if they give you a full CentOS build you should still be able to install PM2, which is a great node process manager.

1 Like