Thinkmill / keystatic

First class CMS experience, TypeScript API, Markdown & YAML/JSON based, no DB
https://keystatic.com
MIT License
1.14k stars 75 forks source link

Slug field: execute `generate` on every save to ensure valid slugs #1211

Open JohannaPeanut opened 2 months ago

JohannaPeanut commented 2 months ago

Hi It's nice that we can give the user control over slugs, that makes sense in some places. But it would be very helpful if generate is not only executed on "Regenerate"-Click but also on every save. I had assumed that this would happen, but unfortunately the CMS user can "break" the slug with spaces, non-alphanumeric characters etc.

henri42 commented 2 months ago

Hi ! I had the same issue with a CMS user who broke his home page for this reason (whitespace and comma in a slug). Maybe a validation property on fields.slug to reject slugs containing whitespaces or special chars could do the trick ?