The schema editor

The schema editor makes it easier to create and edit content type schemas. Schemas can still be created and stored externally to Dynamic Content in AWS, GitHub or whatever hosting service you choose, but the editor allows you to create, edit and manage schemas within your Dynamic Content hub. The schema editor includes snippets for most common property types, validates your syntax as you type and includes a preview feature that lets you see how content created using a schema will look in the content editing window. You can also use the editor for creating slot type schemas, as well as managing partials, or common definitions that can be used in many different schemas.

On this page we'll provide an overview of the features of the schema editor using the example of a simple text block.

There are several other examples in this section:

  • Simple banner example Showing how to create the tutorial banner content type schema using the schema editor. This demonstrates adding an image browser property and string field validation.

  • Slot example shows how to use the schema editor to create a slot type schema

  • Using partials shows how to use the schema editor to create a partial- a schema with just a definitions section- and include these definitions in other schemas. It also shows how to include and refer to a definitions section within the same content type schema.

Overview

Here are the steps you need to follow to create a content type schema and register it as a content type from which the user can create content.

  • Create a content type schema and give it a unique URL. The URL just needs to be valid to ensure that the schema is valid JSON schema format. The URL will not be resolved and we do not enforce any naming standards
  • Choose the validation to be used by the schema editor. For a content type schema choose "content type". You can also create slot schemas and partials
  • Save the schema and open the schema editing window
  • Add the properties you require. The schema editor provides shortcuts for most property types. You can preview how content created from this schema will appear in the content editing form
  • Save the schema. The schema editor will only allow you to the save the schema if it is valid
  • Register a content type from the schema. To create a content type you specify the schema URL, label and optionally an icon, card and visualizations. You also select which repositories the content type is associated with.
  • The content type is now available for the user to create content.

The following example takes you through these steps in more detail.

Creating a content type schema

To create or edit a content type schema, choose "Content type schemas" from the development menu in the Dynamic Content app. If the Development menu is not shown, contact your Custom Success Manager to ensure that you have the required permissions.

Content type schemas are available from the development menu
Content type schemas are available from the development menu

The content type schemas screen will be shown. From here you can view existing schemas or create a new one. To create a new schema click the "Create schema" button as shown in the image below.

Creating a new schema
Creating a new schema

Give the schema a unique ID. To ensure that it is a valid JSON Schema, the schema ID must be a valid URL. The URL will never be resolved, so it can be anything you like. In this example we're using http://example.com/simpletextblock.json and you may wish to use your own domain as a way of organizing your schema types, but we don't enforce any standard.

Choose the type of schema you wish to create: content type, slot or partial. The schema editor will validate the schema based on what it's being used for. Slots can only contain certain property types, while partials refer to schemas containing definitions that can be shared and reused between multiple schemas and will just contain a "definitions" section. In this case we're creating a content type.

You can choose "Save" to save the schema and return to the content type schema window or "Save and open schema" to save and open the schema for editing.

Entering the schema URL and choosing the validation type
Entering the schema URL and choosing the validation type

From the content type schema window you can double-click a schema to open it for editing or choose "Open" from its contextual menu.

You can view or edir an existing schema by double clicking its entry in the list or choosing open from its menu
You can view or edir an existing schema by double clicking its entry in the list or choosing open from its menu

Adding properties

The schema editor opens with a outline of the schema already filled in. All you need to do is add the properties you require.

The schema editor opens with the outline of the schema filled in ready for you to add properties
The schema editor opens with the outline of the schema filled in ready for you to add properties

The editor has type ahead features that will attempt to fill in properties as you type or you can choose the properties you want to add from the "Add property" menu. From here you can choose simple properties such as strings, rich text and numbers as well as chooser properties: content, image and video types. We also support arrays and localized properties. For the simple text block we'll choose a text property.

Properties can be added from the add property menu
Properties can be added from the add property menu

The text property is added with default values for the property name, title and description, as well as the validation. Change these values to whatever you want, ensuring the property name is unique within the schema. In this example we want to allow the user to enter a string of up to 200 characters, so we'll change the maxLength to 200.

Adding a simple text property and changing its validation
Adding a simple text property and changing its validation

The content form preview

You can show a preview of how a content type registered from this schema will look in the content editing window by clicking the "preview" icon as highlighted below.

The preview also applies any validation that you have defined for a property, so in this case the text is limited to 200 characters.

You can preview how the content form will look when the user enters content by clicking the preview icon
You can preview how the content form will look when the user enters content by clicking the preview icon

Adding array properties

The add property menu also provides some shortcuts for adding lists. In the text block example we want to add an array of paragraphs, so we choose "List of text" from the menu. You can also choose images, content links or enums- which are represented in JSON Schema as enums.

Adding an array of text
Adding an array of text

An outline of the array property is added to the schema window. For this example the maximum number of items will be set to 4. Notice that the preview shows the array as it will appear in the content editing window, allowing up to 4 array items to be added.

Previewing the array
Previewing the array

When you've added all the properties you want in your content type schema, click the "Save" button to save it. If any validation errors are shown in the schema editor window, you'll need to correct these before the schema can be saved.

Registering a content type

In order for the content type schema to be used, you first have to use it to register a content type. A content type consists of the schema URL, together with a label and optionally an icon, card and one or more visualizations. Content types are what are what the users will use to create content in the production view of the Dynamic Content app.

To register a content type, choose "Content types" from the development menu. A list of the content types that are already registered will be displayed. To register a new content type click the "Register content type" button as shown in the image below.

Registering a content type
Registering a content type

The register content type screen is opened. The first thing you need to enter is the URL of the content type schema. As we mentioned earlier, content type schemas can either be created using the schema editor and stored internally or stored on an external hosting service. In this example we want to register the text block as a content type so we'll choose "internal". Click underneath the "Pick a schema" text and choose which schema to use. Once a content type is registered, you can update its label, icon, card and visualization, but the URL cannot be changed.

Choosing to register the simpletextblock
Choosing to register the simpletextblock

For the text block we'll give it a label of "Simple text block" and enable it on the repository named "content". See registering content types for more details about associating content types with repositories and adding icons, cards and visualizations.

When you've filled in all the fields you require, click the "Save" button. The content type is now registered with the hub and available to use to create content in the repositories you associated it with.

he text block content type is now registered
he text block content type is now registered

In the production view choose "Create content". The simple text block is shown and you can use this to create content.

The user can create content from the simple text block content type
The user can create content from the simple text block content type

The content editing window opens and the user can fill in the fields and save the content.

Creating a text block content item
Creating a text block content item

Editing a schema

You can edit a schema by double-clicking it in the schema list or choosing "Open" from its contextual menu. In the text block example we want to edit the "propertyOrder" property to ensure that the properties are shown in the correct order in the content editing form. When you make a change to a schema, make the change and click "Save". If the schema is still valid, your change will be applied.

Editing a schema. Updating the propertyOrder
Editing a schema. Updating the propertyOrder

If you make a change to the schema and you've already used it to register a content type then you need to "sync" the content type with the schema to ensure that the content type uses the latest version.

To update the text block, choose "Sync with schema" from its menu in the content types window.

If you update a schema, you will need to sync its content type with the schema
If you update a schema, you will need to sync its content type with the schema

When the user views or edits content of this type in the production view, the properties are now shown in the correct order.

The content type now uses the updated schema
The content type now uses the updated schema

Note that changing the order of properties in a content type schema will not effect any content already created, but care should be taken when updating a schema. See Syncing a content type with its schema for more information.

Simple banner example

Slot example

Using partials

Registering a content type

Syncing a content type with its schema

results matching ""

    No results matching ""