Models

This article explains how to create a model in Prepr, including how to manage settings and add fields.

This video was created using AI avatars and voices to ensure a consistent look and feel. The use of AI matches our culture of using innovative technologies.

Create a model

Use the Schema Editor to create different models. You can create models from scratch, create a model using an existing template or import an model. When you create a model from scratch, you can choose to create a Multi-item model or a Single-item model.

Note

When someone else is working on the same schema, for example, they add a new model or delete an existing model, you'll see those changes in real-time within the schema editor.

Multi-item model

In most cases, you will create multi-item models. These are models for which you allow content editors to create multiple content items.

To create a multi-item model, follow these steps:

  1. Click the Schema tab to open the Schema Editor.
  2. Then, click the + Create model button.
  3. Click Start from scratch.
  4. Click Multi-item model and click Next.
  5. Name and describe your model as follows and click Next.
General fields
Description
Display nameChoose a unique name for the model
Singular nameThis value is important for making requests with the GraphQL API. When you create a new model, this value is auto-generated as follows: PascalCase version of the model name, stripped of all non-alphanumeric characters. For example, the model name News article generates NewsArticle.
Plural nameThis value is the same as the Singular name, except that the auto-generated value is the plural of the Singular name, for example, the model name 'News article' generates NewsArticles.
DescriptionFill in a description to help editors manage content by showing the purpose of this model.

Add-model

  1. Choose additional options and click Create. Check out Manage settings for more details.

Single-item model

In some cases, you want to allow the content editor to only be able to create one content item for a model, for example, for app configuration settings such as the app name or company info.

To create a single-item model, follow these steps:

  1. Click the Schema tab to open the Schema Editor.
  2. Then, click the + Create model button.
  3. Click Start from scratch.
  4. Click Single-item model and Next.
  5. Name and describe your model as follows and click Next:
General fields
Description
Display nameChoose a unique name for the model
Singular nameThis value is important for making requests with the GraphQL API. When you create a new model, this value is auto-generated as follows: PascalCase version of the model name, stripped of all non-alphanumeric characters. For example, the model name News article generates NewsArticle.
DescriptionFill in a description to help editors manage content by showing the purpose of this model.
  1. Choose additional options and click Create. Check out Manage settings for more details.

Add-single-item-model

Note

You can easily identify a single-item model in your list of models by looking for this icon.

Model template

It's possible to create a model by using a template instead of creating an empty model. You can choose one of the following templates: Page, Blog, Live stream, Navigation, or App config. For more details on how to model these patterns, check out the Example patterns doc.

To create a model from a template, follow these steps:

  1. Click the Schema tab to open the Schema Editor.
  2. Then, click the + Create model button.
  3. Click Select a template.
  4. Choose a template, for example, Page.
  5. Review the model and fields and click Confirm.

Add-template-model

Edit or delete a model

To edit a model, follow these steps:

  1. Click the Schema tab to open the Schema Editor.

  2. Click on a model from the list of models on the left and apply your changes.

example-model

Note

When someone else is editing the same model that you are working on, for example, they change the order of the fields, you will be notified about those changes. In this case, you need to click to apply those changes to your model.

To delete a model, follow these steps:

  1. Click the Schema tab to open the Schema Editor.
  2. Click on a model from the list of models on the left.
  3. Click on the button at the top of the model.
  4. Click Delete.

delete-model

Manage settings

To change settings for a model, follow these steps:

  1. Click the Schema tab to open the Schema Editor.
  2. Click on the model from the list of models on the left.
  3. At the top of the model, click Settings to open the setting options for a model.

The following categories of settings are available:

  • General: You can edit the names and description for the model.
  • Sidebar: You can set options to configure the sidebar of content items.
  • Preview URLs: You can add URLs to let content editors preview content items. For more details on the Preview URLs tab, check out the Preview content items doc.

See a list of the Sidebar options below:

Sidebar options
Description
WorkflowThis option is enabled by default. When you disable this setting, the Workflow stage and Assignee won't show up on the sidebar. Disable workflow for items that don't require collaboration with other content editors such as menu items or categories.
SchedulingThis option is enabled by default and allows content items to be scheduled for publishing or archiving. When you disable this setting, the Scheduling details won't show up on the sidebar and the content item will be scheduled at the creation time automatically.
SEO scoreThis option is enabled by default and allows content editors to check how well the content performs for search engines. For more details, check out the Optimizing content items for search engines doc.
Engagement insightsWhen you enable this setting, the content editor can see and analyze engagement on content items.
CommentingWhen you enable this setting, the content editor can see and make comments for the purpose of reviewing content items.
VersioningWhen you enable this setting, Prepr keeps track of all the changes in a content item. It allows a content editor to revert to a previous version when needed and to view the revision history. For more details, check out the Versioning doc.

model-settings

Add fields to a model

To add fields to your model, follow these steps:

  1. Click the Schema tab to open the Schema Editor.
  2. Click on the model from the list of models on the left.
  3. Drag and drop the desired field type, for example, Text, from the list on the right into your model.

For a complete list and all the specs, check out Prepr field types.

Let's look at some basic settings that are common across all field types.

  1. Using Text as an example, fill the General settings as follows:
General fields
Description
Display nameThe field label shown in the content editing interface.
IDThe value of this field is automatically generated. The technical ID of this field that is used, for example, to retrieve content through the API.

For more details on the other Text settings, check out the Text field type.

  1. Click the Appearance tab to set the appearance options for the field.
Appearance fields
Description
Help textAn instruction to help content editors. Make instructions clearer by making text bold, italic, or bolditalic. Use the following standard Markdown syntax:
*. and _ (italic)
** and __ (bold)
*** and ___ (bolditalic).
Show in preview (deprecated)Enable this option to make the field visible in the preview , which can be accessed using the Preview button in the sidebar of the content item editing interface.

Note: From April 24th, 2023, the Preview button is no longer available for new Prepr accounts created after this date. To review your content before publishing, please set up a review URL on a model. Learn more
Disable editingActivate this option if you don't want a content editor to edit this field. For example, when this field is only supposed to be edited through an API or content automation.
  1. Click the Validation tab to set up validation rules for the field.

Enable This field is required if this is a mandatory field. The validation only triggers when a content item is set to the Done stage. For more details, check out the Workflow stages doc.

For more details on the other Text validation options, check out the text field type.

Add-model-fields

Warning

Making changes to fields for a model that is already filled with content could lead to unexpected query results. For example, when you change or delete fields, then the existing content doesn't show up in the query results. Also, when you change existing field names, update your API queries accordingly.

Add sections

Use sections to determine the display of the fields in your content item. It allows you to organize the view of a content item for your content editors and is useful for grouping topics. For example, separate the metadata from the content such as a group of SEO fields versus article content.

To add a section, follow these steps:

  1. Click the Schema tab to open the Schema Editor.
  2. Click on the model from the list of models on the left.
  3. Click the + Section button. Fill in a name and description (optional) to save the section.
  4. Drag the section above the fields that you want to group.

Add-section

See an example of a Metadata section in the content item below:

sections in content item

Add columns

You can also use columns to determine the display of the fields in your content item. Columns are used to divide component fields into a maximum of six columns. This is useful when you use several smaller fields, such as short text fields, list, color, or boolean fields. With columns, you can display those fields next to each other.

To add columns, follow these steps:

  1. Click the Schema tab to open the Schema Editor.
  2. Click on the model from the list of models on the left.
  3. Click the + Columns button.
  4. Drag the column element above the fields that you want divided into columns.
  5. Choose the number of columns that you want those fields to be grouped into.

add-columns

See an example of social account fields organized into columns below:

columns in content item

Exceptions

  • A dynamic content editor field will always be visible as a one-column field.

  • Screen resolutions smaller than 1024 will also ensure that the content item remains visible in one column.

Note

Sections and columns do not affect the API output of your content items.

View system fields

System fields are system-generated and read-only fields that provide information about the content. For example, the CreatedOn field is the date when the content was created. Enable the Show system fields toggle to see the list of system fields that are available on a model.

Use the API ID on the right of the field to query the values for these fields in your API request. Click the icon to see more information about the field. Check out the GraphQL API reference docs for more details.

view system fields

Export and import a model

Use the export and import if you only need a couple of models copied from one environment to another. For example, export a model from your staging environment and import the model into your production environment.

To sync all models and components with a schema from another environment then follow the process detailed in the Sync schema doc instead.

To share the same models across multiple environments, for example when an organization has different brands, but needs content in separate environments, you can create a shared schema as detailed in the Shared schemas doc.

To export a model, follow these steps:

  1. Click the Schema tab to open the Schema Editor.
  2. Click on a model from the list of models on the left.
  3. Click on the button at the top of the model.
  4. Click Export model to download a JSON file of the model.

export-model

To import a model, follow these steps:

  1. Click the Schema tab to open the Schema Editor.
  2. Then, click the + Create model button.
  3. Click Or import a model.
  4. Choose the JSON file of the model that you want to import. When you import a model, the settings are also copied across.

import-model

Schema integrity

To avoid schema integrity issues, use the process detailed in the Sync schema doc instead if you need to import models with reference fields, models with embedded components, or models with List fields that include enumeration values.