Is it possible to somehow generate a SLUG not from the title field, but, for example, from your own created field?

Example: A website for analyzing complex mathematical solutions. Each entry in the catalog is a solution to some mathematical task. Each entry has fields:

  • Title (goes by default)
  • Task (created text field)
  • Solution (created text field)

By default, SLUG is formed from the "Title". I want the SLUG to be formed from the field "Task". Is it possible to do this somehow in CRAFT CMS?

1 Answer 1


What I usually do in this scenario is to hide the default Title field and have it be automatically generated from one or more of the custom fields. The slug is then taken care of automatically from the title. This solution assumes that you're happy for the Title to be taken from the first few words of the Task:

  1. Go to the section's entry layout screen
  2. Untick "Show the Title field"
  3. Add some Twig code in the Title Format input (using shortcut syntax if you prefer) for how you want the auto title to be generated. For example, to take the first 120 characters of the "Task" field, minus any markup if it's a Redactor field, use the striptags filter and the truncate filter:

{task|striptags|truncate(120, '...')}

A screenshot of the section settings screen

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.