The URL slug element specifies a SEO-friendly text that you can use in the URLs of your content items. The element automatically generates its value based on the Text content element of your choice, unless you change the element's value manually. You can use the element only once in a content type.

Because the URL slug element can generate its value from any Text element, you can use a different URL slug for each language variant of your content items.

Note that you can no longer choose to generate new URL slugs from content item name. When updating a URL slug element that still uses the content item name to generate its value, you can choose a Text element instead. By doing so, you will no longer be able to switch back to the content item name.

Let’s look at an example of using URL slug in a content type.

Adding URL slug to content types

To add a URL slug to an existing content type:

  1. From the app menu, choose Content models.
  2. Open the Article content type for editing.
  3. Add the URL slug element to the content type.
  4. Type a name of the URL slug element. For example, you can label it "Page URL".
  5. Click the Show configuration icon.
  6. Select a Text element from the drop-down list to generate URL slug.
  7. Click Save.

The drop-down list shows you all Text elements from the current content type and from any content type snippets that are included in the content type.

If there isn't any Text element to choose from, you need to add one first.

The length of a URL slug is only limited by the maximum length of the dependent Text element. Keep in mind that the limitation for the URL in web browsers is usually 2000 characters.

URL slug in content items

In content items, your content contributors will see the URL slug element like this.

In the bottom right corner of the "URL pattern", you can see which Text element generates the URL slug and how many characters it has.

The URL slug value is auto-generated from the Text element without any special characters other than dashes (-) to prevent problems when used in the URL.

You can also customize the URL slug value to suit your needs, which causes the element to switch to the manual mode. As a result, the URL slug will no longer react to changes made to the dependent Text element.

Note: Kentico Cloud doesn't check if the URL slug values in your content items are unique across your project. This means you can have multiple content items with the same URL slug value.

Deleting dependent Text elements

When deleting a Text element that is currently used to generate URL slug, there are two options depending on the location of the Text element:

  • In content types, you'll be able to delete the dependent Text element. After deleting the element, you'll be asked to choose a different Text element before saving the changes. If you don’t have a Text element in the current content type, you’ll need to create a new one.
  • In content type snippets, you won't be able to delete a dependent Text element. First you need to choose a different Text element to generate URL slug by changing it directly in the content type. After that, you can come back to delete the Text element in the content type snippet.

Warning: This action is not reversible. Removing an element from a content type or content type snippet removes the element across all affected content items.

What’s next?

Did this answer your question?