Netlify CMS there has no configurable slug type for content models. This means that the front matter slug field isn't treated any differently than any other front matter string.

Since Netlify CMS is a git-based headless CMS, it will generate an actual file when creating content. By default, it generates the slug for new pages, posts or uploads based upon the title. You can configure how these slugs are generated in the site config. This doesn't give the user access to a slug field in the content though.

A front matter slug in Netlify CMS would simply be a string widget. While Netlify CMS does not allow you to generate the slug or validate that it is unique, you can add a pattern validation to ensure that it meets certain criteria like not using special characters or spaces. The below snippet from a Netlify CMS configuration validates a slug field based upon a regex pattern taken from here:

- widget: string
  name: slug
  label: Slug
  required: true
  pattern: ['^[a-z0-9]+(?:-[a-z0-9]+)*$','A slug can have no spaces or special characters']
  hint: >-
    The post URL (do not include folder or file extension)

It's worth noting that Netlify CMS also supports custom widgets and these may allow for the creation of a custom slug widget.

Ready to get started?