Default keyword
The properties in this schema example demonstrate how to make use of the default keyword. The default
keyword allows you to set the default value of an item and can be used with strings, numbers, booleans and lists, as well as content and image links. The example schema includes each of these property types.
Pre-requisitesLink copied!
None. This is a self contained schema.
How to useLink copied!
You can use the defaults demonstrated in this schema for your own properties.
To use the example-image-link
and example-content-link
properties you will need to update these properties to use an image and a content item from your own hub.
In the example-image-link
property, the default value includes all the properties returned by an image-link
object, including the id, name, endpoint and default host. The easiest way to find all these values is to publish a content item containing the image and view the item in JSON format from a link in the "Content delivery" section of the content form. See content item properties for more details.
For the example-content-link
property you can also find the contentType and id fields from the content item properties window and use these values to define a default content-link
.
Defaults exampleLink copied!
Content form previewLink copied!
An example of creating a content item using a content type registered from the defaults example schema is shown in the image below.