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
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:
- Click the Schema tab to open the Schema Editor.
- Then, click the + Create model button.
- Click Start from scratch.
- Click Multi-item model and click Next.
- Name and describe your model as follows and click Next.
General fields | Description |
---|---|
Display name | Choose a unique name for the model |
Singular name | This 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 name | This 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. |
Description | Fill in a description to help editors manage content by showing the purpose of this model. |
- 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:
- Click the Schema tab to open the Schema Editor.
- Then, click the + Create model button.
- Click Start from scratch.
- Click Single-item model and Next.
- Name and describe your model as follows and click Next:
General fields | Description |
---|---|
Display name | Choose a unique name for the model |
Singular name | This 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. |
Description | Fill in a description to help editors manage content by showing the purpose of this model. |
- Choose additional options and click Create. Check out Manage settings for more details.
Note
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:
- Click the Schema tab to open the Schema Editor.
- Then, click the + Create model button.
- Click Select a template.
- Choose a template, for example, Page.
- Review the model and fields and click Confirm.
Edit or delete a model
To edit a model, follow these steps:
-
Click the Schema tab to open the Schema Editor.
-
Click on a model from the list of models on the left and apply your changes.
Note
To delete a model, follow these steps:
- Click the Schema tab to open the Schema Editor.
- Click on a model from the list of models on the left.
- Click on the button at the top of the model.
- Click Delete.
Manage settings
To change settings for a model, follow these steps:
- Click the Schema tab to open the Schema Editor.
- Click on the model from the list of models on the left.
- 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 |
---|---|
Workflow | This 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. |
Scheduling | This 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 score | This 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 insights | When you enable this setting, the content editor can see and analyze engagement on content items. |
Commenting | When you enable this setting, the content editor can see and make comments for the purpose of reviewing content items. |
Versioning | When 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. |
Add fields to a model
To add fields to your model, follow these steps:
- Click the Schema tab to open the Schema Editor.
- Click on the model from the list of models on the left.
- 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.
- Using Text as an example, fill the General settings as follows:
General fields | Description |
---|---|
Display name | The field label shown in the content editing interface. |
ID | The 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.
- Click the Appearance tab to set the appearance options for the field.
Appearance fields | Description |
---|---|
Help text | An 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 editing | Activate 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. |
- 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.
Warning
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:
- Click the Schema tab to open the Schema Editor.
- Click on the model from the list of models on the left.
- Click the + Section button. Fill in a name and description (optional) to save the section.
- Drag the section above the fields that you want to group.
See an example of a Metadata section in the content item below:
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:
- Click the Schema tab to open the Schema Editor.
- Click on the model from the list of models on the left.
- Click the + Columns button.
- Drag the column element above the fields that you want divided into columns.
- Choose the number of columns that you want those fields to be grouped into.
See an example of social account fields organized into columns below:
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
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.
Export and import a model
To export a model, follow these steps:
- Click the Schema tab to open the Schema Editor.
- Click on a model from the list of models on the left.
- Click on the button at the top of the model.
- Click Export model to download a JSON file of the model.
To import a model, follow these steps:
- Click the Schema tab to open the Schema Editor.
- Then, click the + Create model button.
- Click Or import a model.
- Choose the JSON file of the model that you want to import. When you import a model, the settings are also copied across.
Export and import models when you want to use a model from one environment in another environment, for example, export a model from your staging environment and import the model into your production environment.