Webpage Slug Validation

we just noticed something - not a big deal and we can work around it - but better to let you know :wink:

Background: we create items via the Content Management API and use the lowercased Dato ItemID as slug. In the past with the numeric id’s no problem, with the new IDs introduced last year we noticed errors.

You can reproduce it also in the interface by pasting this slugs directly in a “webpage slug” validate slug field:
abews6uf_8tykl7vlmjc37-4-a → mix of underline and minus works fine
a-bews6uf_8tykl7vlmjc37-4-a → error. just added another minus sign

Maybe you can explain the default “webpage slug” regex used to validate a slug field.


Huh… that’s… weird. I bet that’s a bug. I’ll report it right away, thanks!

Our current slug regex is /^[a-z0-9_]+(?:-[a-z0-9]+)*$/, but that’s definitely wrong:

Thanks for the report!

1 Like

@thomas.iacopino This should be fixed now!

The regex has been relaxed to simply [a-z0-9\-_] (alphanumeric, dashes, underscores). We still recommend that you not go too overboard, though, just for SEO :slight_smile:

Thanks again for the report!