Duplicate slug names, is it possible?

Hi all. Is it possible to create a slug with the same name twice? currently on my app; when a customer creates a product, they have the ability to choose the slug name for their product, to make it easy to share on social media etc. (eg www.myapp/products/chosenslug) at the moment, my app searches against the existing database and prevents someone from creating a slug that is already taken.

However, I would like for a customer to be able to create a product with their chosen slug regardless of if the name is already taken. If I do this, the problem is, when the URL is copied and shared, will bubble know which product to display if there is more than one slug with the same name?

The only thing I can think of doing, is having a hidden box at the bottom of the product page, which reads “current product creators Unique ID” and instead of searching for a product from the URL parameter, to search for the product which is inside the creator user ID box. I am not sure this will work though because how will bubble know which creator ID to pull?

Or another idea is to shove another parameter in there, and have the datasource pull from that parameter as well… eg www.myapp/products/personsname/slug

Any suggestions? If Facebook can have 500 different John Smiths, I am sure my app can have two of the same product names :sweat_smile:

https://manual.bubble.io/help-guides/structuring-an-application/page-slugs#slug-duplication

Slug duplication is not allowed. Bubble will simply add a progressive number at the end.
You can use slug conditionals to check if a slug is allowed, bubble will do the check in the database for you.

You can have things share the same slug value if they are of different data types. However, you cannot have two things of the same data type with the same slug value. If you try, it will append slug-1, slug-2, slug-3, and so on and so forth.

source

1 Like

awww :frowning: okay
what about:
“Or another idea is to shove another parameter in there, and have the datasource pull from that parameter as well… eg www.myapp/products/personsname/slug”

search for the product where the persons full name (#2 of string) and the product name (#3 slug) is matched?

Thanks! hopefully I can avoid this issue somehow

You can compose url path or parameters as you wish, as long as you have a unique combination that allows you to search the data in the database.
Facebook can have 500 different John Smiths but it also assign an unique identifier to each one.

You can opt for something like myapp.com/products/storename/productname
instead of using bubble’s slug you use a text field in the product data. Of course now you are responsible of checking for duplicates and validating/formatting this new slug.

thanks! I might implement this in the future :slight_smile: