The Unique ID field adds a unique ID to your content. You can also make it editable and choose between using the file path of the content file, a custom template, or a generated UUID as the initial value. Aside from its dynamic content, it differs from a standard text input in that it allows the value to be reset to its initial value should it be changed.
Editing UI Widget
This field is displayed as a text input labelled with the field’s label
in the Content Editor with a button to reset it to its initial value once the generated value was changed.
Output Format
The Unique ID field outputs the ID as a string.
Options
The following options are available for this field (default values shown):
{
"type": "uuid",
"idTemplate": null,
"editable": false
}
type: the type of ID to generate, either
filepath
to use the content file’s path within the project, oruuid
to use a randomly generated universally unique identifier. If set totemplate
theidTemplate
is usedidTemplate: the template to use for generating the ID when
type
is set totemplate
. Check out the article on URL Templates to see how this works. Special dynamic fields such asfilepath
are not available for ID templateseditable: whether or not the field should be editable. It may be useful to keep a Unique ID field visible, but uneditable in case the ID needs to be referenced by a user somewhere else
Validation
The following validation options are available for this field (default values shown):
{
"required": true
}
Notes
If editable
is set to true
and a Content Editor changes the value, there is no way to guarantee its uniqueness. It might be advisable to only show the field to a limited group of collaborators who need to change it in this case using the field’s visibility settings.
If the type
is set to filepath
and the content file is moved from a file list, the ID will not reflect that change instantly and still point to the old file path. This could potentially cause the ID to no longer be unique. The ID will be updated the next time the file is opened in Mattrbld and saved (unless it has editable
set to true
), so if you move a file, open it and hit “Save” just to be safe. 😉
Additionally, the ID will always reflect the final path of the file within the project, regardless of whether the file currently is set to be a draft (and thus lives in the drafts directory), or not.
If the type
is set to template
, editable
will always be implicitly assumed to be false
. In addition to that, it is at your discretion to ensure the ID generated from the template is unique if you need it to be so.
When duplicating content items in a Collection, the entire content item is duplicated, including all of its fields. However, to not break the assumption that Unique IDs are in fact unique, they will be updated to either be newly generated UUIDs, or reflect the new name of the duplicated file, in case type
is set to filepath
. IDs based on a template, i.e. when type
is set to template
will no longer be unique, since they are based on fields that were duplicated without modification.
Version History
Version at launch: 3