Help articles

Slug: `slugifyFn` renamed

The Studio reports Heads up! The "slugifyFn" option has been renamed to "slugify". when a slug field still uses the old option name. Rename slugifyFn to slugify.

The signature is (source, schemaType, context), and it can return a promise if you want to generate the slug asynchronously:

import {defineField} from 'sanity'

defineField({
  title: 'Slug',
  name: 'mySlugField',
  type: 'slug',
  options: {
    source: 'title',
    slugify: (value) => someAsyncSlugGenerator(value),
  },
})

The old option still works in Studio v6, it is aliased to slugify, but it emits a schema validation warning and is deprecated.

Was this page helpful?