Like what we’re doing? Star us on GitHub!

Understanding Slugs / admin UI names?

Rar9
5 months ago
1 1

A Slug is the unique identifying part of a web address, typically at the end of the URL and its recommend to avoid special characters like commas, semicolons, colons, spaces, quotes.

unsafe-characters-url.jpg

From my understanding the Admin UI collection Names are generated from slugs.

If I require a nicer admin UI Name, I would need to currently break the Slug suggestion by using a Space when using 2 Words instead of a dash/underscore.

Screenshot_20221019_201534.jpg

From Demo Slug code spaces would still produce correct urls.

const format = (val: string): string => val.replace(/ /g, '-').replace(/[^\w-]+/g, '').toLowerCase();

Or did I oversee something that the admin UI Name can be specified somewhere?

P. S. Perhaps adding for Admin UI a word wrap to get 2x lines could be added, as we still have enough space in our boxes.

  • jmikrut
    Payload Team
    5 months ago

    Hey @Rar9 — you can specify nicer names using labels: { singular: 'Page', plural: 'Pages' } on Collections. But by default we use the name if you don't add more specificity. You can check the docs for more information here!

    1 reply
  • Rar9
    5 months ago

    Thanks for the fast response ....

    I searched in docs for slug / label / name/admin but this didn't show up.

Open the post
Continue the discussion in GitHub
Can't find what you're looking for?
Get help straight from the Payload team with an Enterprise License.Learn More