Using Fields in Data URLs

Customize URLs for data items

You can include fields of certain types in custom data URLs.

You can select a field the value of which will be used in data URLs when creating or editing a data type.

What fields can be used in data URLs?

You can only select the fields that meet these two requirements:

  • It must be required (not optional)
  • It must be one of these types:
    • String (up to 128 characters)
    • GUID
    • Integer
    • Decimal
    • Date
    • Data Reference

Selecting fields for data URLs

  1. Create or edit a data type.
  2. On the Basics tab, add or edit a field of one of the supported types (see above).
  3. Make sure the field is not optional.
  4. On the Advanced tab, below "Data URL" check the "Use in data URLs" option.
  5. If necessary, in the "Order" drop-down list select in what position the field should appear in the data URL (see below "Order of fields in data URLs").
  6. If the field is of the Date type, select the date format if necessary (see below "Format for Date fields in data URLs").
  7. Repeat Steps 2-6 for as many fields as you need.
  8. Save the changes.

Order of fields in data URLs

If you are using more that one field in data URLs, you can also choose the order the fields should appear the data URL relative to each other.

For example, if you've chosen fields "Id" and "Title" for data URLs, you can choose between these two options:

  • {Id}/{Title}
  • {Title}/{Id}

Format for Date fields in data URLs

If you are using a field of the Date type in data URLs, you can also select one of the predefined date formats for it:

  • Year
  • Year/Month
  • Year/Month/Day

Data reference fields in data URLs

If you are using data reference fields for data URLs, bear in mind that by default the raw value of the data reference is applied. This a key field value which might be a GUID, or a random 8- or 4-character string.

If the referenced data type has data URL setup, too, it will be injected into resulting URL instead. For example, the "Label" field can be used instead of an ID to display a reference field in a data URL.

Requirements:

C1 CMS version 5.0 or later