Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QUESTION] Slugify a tier list's title #19

Open
1 task done
YummYume opened this issue Dec 1, 2022 · 2 comments
Open
1 task done

[QUESTION] Slugify a tier list's title #19

YummYume opened this issue Dec 1, 2022 · 2 comments
Assignees
Labels
priority 2 Pretty important - Something vital that requires attention question Concerns a question or a demand
Milestone

Comments

@YummYume
Copy link
Contributor

YummYume commented Dec 1, 2022

Question

How do we go about turning the tier list's title into a slug? More specifically, how do we want to limit user input on the title of the tier list, and what should the slug look like?

We can think about it like that:

  • A user cannot have multiple tier lists with the same name (makes sense but requires taking off the unique attribute on the slug field in the DB, and instead implementing custom validations.
  • A user can only use certain characters for a tier list's name (like letters, numbers, and spaces).
  • By doing so, URLs would have to contain the user's name or "tag", which should also be unique (eg: /yam/tier-lists/my-tier-list).

We could also imagine that instead, a slug is unique in the DB but by doing so, we are forced to have a random and unique value at the end of the slug (eg: my-tier-list-197625469) which would greatly reduce the collision rate.

Additional information

There is no "good" or "wrong" answer here. All ways of doing this require a different implementation, but we should look at what is really the best for us and what users would enjoy the most.

Code of Conduct

  • I agree to follow this project's Code of Conduct
@YummYume YummYume added priority 2 Pretty important - Something vital that requires attention question Concerns a question or a demand labels Dec 1, 2022
@YummYume YummYume added this to the 1.0 milestone Dec 1, 2022
@YummYume
Copy link
Contributor Author

YummYume commented Dec 31, 2022

I am personally leaning towards having unique slugs per user. But now the real question is, do we allow using the same name (thus, slug) multiple times? If yes then...

  • Either add a -1 after the slug if it already exists (requires additional DB calls),
  • Or add a random number at the end of the slug to almost nullify collision risks (would result in less friendly URLs).

So with method one, a URL could look like this :

https://rankylist.com/user/yam/tier-list/my-awesome-tier-list (with my-awesome-tier-list-1 if there is already a tier list with this slug for this user).

Method two :

https://rankylist.com/user/yam/tier-list/my-awesome-tier-list-197625469.

I prefer the first method, but since it requires additional DB calls it could mean reduced performance. It would require some ingenious verifications and logic to reduce the DB calls as necessary.

We can also think about not letting the user use the same name multiple times to avoid similar slugs, but then another problem would kick in :

  • My awesome tier list
  • My awesome tier list--

Would both result in the same slug : my-awesome-tier-list. So we would also need to make heavy restrictions on the name.

@YummYume YummYume assigned Spacelocust and unassigned LeoBruant and YummYume Apr 30, 2023
@YummYume
Copy link
Contributor Author

Check the possibility of doing so with PocketBase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority 2 Pretty important - Something vital that requires attention question Concerns a question or a demand
Projects
None yet
Development

No branches or pull requests

3 participants