function

Slug

func Slug( name, sourcePath string, options ...StringOption, ) Definition

Define a required, unique, indexed text slug derived from another string field.

Source field/slug.go:11

@param name
The name value.
@param sourcePath
The sourcePath value.
@param options
The options value.
@returns
The declared result.

The server normalizes create and update values, follows source changes while generated, and preserves manual overrides. Sources may traverse non-repeated groups but cannot be localized.

Example

go
field.Slug("slug", "title", field.Label("URL slug"))

Related types

  • StringOption

    Options accepted by Text, Slug, Textarea, Email, Code, and Date.

  • Definition

    An immutable authored field definition.

Related guides