Create custom unique url links if url is taken

Hi, so I choose a ‘name’ as a page default path, and not an ID. The ‘name’ is taken from user’s form field, so the name is not entirely unique. I wonder if I can create a custom unique no. each time a same url/name occurs. Example the page domain.com/khairul is already taken. If someone else choose a domain.com/khairul, they will get domain.com/khairul-2 or khairul2 automatically. Can I do that? Also do I have a way to make the default path of a static collection that belongs to another static collection, becomes domain.com/collection1-item1/collection2-item1?

  1. WeWeb will not handle making unique names for you in static collections. As a matter of fact, I believe this will cause an error if you have matching names in the path for collection pages.

You will need to handle the unique requirement in your record creation logic when you are creating the records.

  1. No, at the time, you cannot add another layer to the url routing for WeWeb collections.

If pretty urls are not a top priority for you, your use case may benefit more from dynamic data using query strings like

Domain.com/?name=Khairul

2 Likes

i think I found a workaround, make a custom variable of name+ID, if ID 1and input it into data, then use it as URL.

same as 2, maybe can input a data by binding a variable of say collection-name/name and use them as url.

I’m not sure if they would work though

I think weweb need to add formulas when setting a page default path, maybe that would work

1 Like

Adding it to our list of user suggestions :slight_smile: Thanks @khairul!

1 Like