Change Slug from ID to Title


#1

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?


#2

@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.


#3

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


#4

@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.,

NODE_ENV=production
SECRET_KEY=abc123

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.


#5

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


#6

@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
https://mallinson.ca/posts/12/vapid-on-digital-ocean


#7

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


#8

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.