Working with the Slug field

You can configure an initial value for slugs using the slug field type. This field is of type String in your GraphQL schema but provides a powerful UI feature that comes in the form of automatic initial value generation.

You can configure the slug field to be generated from other field values in your model.

Create a slug fieldAnchor

  1. Navigate to the schema editor tab.
  2. Find a model you'd like to create a slug field for.
  3. Click on Slug from the list of fields.
  4. Give the field a name (typically Slug), API ID (also typically slug), and optional description.
  5. Under "Slug options", specifiy whether this field should be lowercase, and enable whether you want this field to be generated from a template.
  6. If you opted to generate from template, enter a template for your slug.
  7. Configure any additional settings for the model. By default, the field will be set to unique, and match a specific pattern will be provided.
  8. Click "Create".

Slug templatesAnchor

Each Slug field template can be generated using the Available fields outlined above the input. If your model has a title, or name field, you could specify the slug template as {title}, or {name} respectively.

Using the slug fieldAnchor

When creating content, the slug field will be automatically generated from the template field you're using.

For example, if your slug field is based off a title field, when you start typing into the title field, it will also update the slug field.

You can override the slug field value by typing in the box. You can also "Regenerate" the value to fallback to the template you provided.

Did you find this page useful?

Your feedback helps us improve our docs, and product.