Forum

Thread tagged as: Question

Avoid duplicate slugs

Is there a setting or ability to automatically avoid duplicate slugs? I have a collection and I want to disable the ability to edit the slugs, however, due to the initial construction of the website, and the growth within this collection, it has now become apparent that there might be many instances of slugs being the same, as they are generate from a firstname and initial of surname. It would be great to detect this and auto increment in any instance, for example. terryu and terryu-1, terryu-2 etc

Terry Upton

Terry Upton 0 points

  • 3 years ago

Hi Terry,

As far as I know its no automatic detection on that.

But I believe you have a unique "_id" field you could take advantage of. Maybe compositing that with your current slug to create a new slug that will be guaranteed to be unique.

Otherwise I would work on the routing; ie. having /year/month/terryu – however detailed it needs to be to avoid

Eddie