Content Fragment Models

CAUTION

The AEM GraphQL API for Content Fragments Delivery is available on request.

Please reach out to Adobe Support to enable the API for your AEM as a Cloud Service program.

Content Fragment Models define the structure of content for your content fragments.

To use Content Fragment Models you:

  1. Enable Content Fragment Model functionality for your instance
  2. Create, and configure, your Content Fragment Models
  3. Enable your Content Fragment Models for use when creating Content Fragments for use when creating Content Fragments

Creating a Content Fragment Model

  1. Navigate to Tools, Assets, then open Content Fragment Models.

  2. Navigate to the folder appropriate to your configuration.

  3. Use Create to open the wizard.

    CAUTION

    If the use of content fragment models have not been enabled, the Create option will not be available.

  4. Specify the Model Title. You can also add Tags, and a Description if required.

    title and description

  5. Use Create to save the empty model. A message will indicate the success of the action, you can select Open to immediately edit the model, or Done to return to the console.

Defining your Content Fragment Model

The content fragment model effectively defines the structure of the resulting content fragments using a selection of Data Types. Using the model editor you can add instances of the data types, then configure them to create the required fields:

CAUTION

Editing an existing content fragment model can impact dependent fragments.

  1. Navigate to Tools, Assets, then open Content Fragment Models.

  2. Navigate to the folder holding your content fragment model.

  3. Open the required model for Edit; use either the quick action, or select the model and then the action from the toolbar.

    Once open the model editor shows:

    • left: fields already defined
    • right: Data Types available for creating fields (and Properties for use once fields have been created)
    NOTE

    When a field as Required, the Label indicated in the left pane will be marked with an asterix (*).

  4. To Add a Field

    • Drag a required data type to the required location for a field.

    • Once a field has been added to the model, the right panel will show the Properties that can be defined for that particular data type. Here you can define what is required for that field.
      Many properties are self-explanatory, for additional details see Properties.

  5. To Remove a Field

    Select the required field, then click/tap the trash-can icon. You will be asked to confirm the action.

  6. Add all required fields, and define the related properties, as required.

  7. Select Save to persist the definition.

Data Types

A selection of data types is available for defining your model:

  • Single line text
    • Add one, or more, fields of a single line of text; the maximum length can be defined
  • Multi line text
    • A text area that can be Rich Text, Plain Text or Markdown
  • Number
    • Add one, or more, numerical fields
  • Boolean
    • Add a boolean checkbox
  • Date and time
    • Add a date and/or time
  • Enumeration
    • Add a set of checkbox, radio button(s), or dropdown fields
  • Tags
    • Allows fragment authors to access and select areas of tags
  • Content Reference

Properties

Many properties are self-explanatory, for certain properites additional details are below:

  • Render As
    The various options for realizing/rendering the field in a fragment. Often this allows you to define whether the author will see a single instance of the field, or will be allowed to create multiple instances.

  • Field Label
    Entering a Field Label will autogenerate a Property Name, which can then be manually updated if required.

  • Validation
    Basic validation is available by mechanisms such as the Required property. Some data types have addition validation fields. See Validation for further details.

  • For the data type Multi line text it is possible to define the Default Type as either:

    • Rich Text
    • Markdown
    • Plain Text

    If not specified, the default value Rich Text is used for this field.

    Changing the Default Type in a content fragment model will only take effect on an existing, related, content fragment after that fragment is opened in the editor and saved.

Validation

Various data types now include the possibility to define validation requirements for when content is entered in the resulting fragment:

  • Single line text
    • Compare against a predefined regex.
  • Number
    • Check for specific values.

Enabling or Disabling a Content Fragment Model

For full control over the use of your Content Fragment Models they have a status that you can set.

Enabling a Content Fragment Model

Once a model has been created it needs to be enabled so that it:

  • Is available for selection when creating a new Content Fragment.
  • Can be referenced from within a Content Fragment Model.
  • Is available to GraphQL; so the schema is generated.

To enable a Model that is flagged as either:

  • Draft : mew (never enabled).
  • Disabled : has been specifically disabled.

You use the Enable option from either:

  • The top toolbar, when the required Model is selected.
  • The corresponding Quick Action (mouse-over the required Model).

Enable a Draft or Disabled Model

Disabling a Content Fragment Model

A model can also be disabled so that:

  • The model is no longer available as a basis for creating new Content Fragments.
  • However:
    • The GraphQL schema keeps being generated and is still queryrable (to avoid impacting JSON API).
    • Any Content Fragments based of the model can still be queried and returned from the GraphQL endpoint.
  • The model cannot be referenced anymore, but existing references are kept untouched, and can still be queried and returned from the GraphQL endpoint.

To disable a Model that is flagged as Enabled you use the Disable option from either:

  • The top toolbar, when the required Model is selected.
  • The corresponding Quick Action (mouse-over the required Model).

Disable an Enabled Model

Deleting a Content Fragment Model

CAUTION

Deleting a content fragment model can impact dependent fragments.

To delete a content fragment model:

  1. Navigate to Tools, Assets, then open Content Fragment Models.

  2. Navigate to the folder holding your content fragment model.

  3. Select your model, followed by Delete from the toolbar.

    NOTE

    If the model is referenced a warning will be given. Take action appropriately.

Publishing a Content Fragment Model

Content fragment models need to be published when/before any dependent content fragments are published.

To publish a content fragment model:

  1. Navigate to Tools, Assets, then open Content Fragment Models.

  2. Navigate to the folder holding your content fragment model.

  3. Select your model, followed by Publish from the toolbar.
    The published status will be indicated in the console.

    NOTE

    If you publish a content fragment for which the model has not yet been published, a selection list will indicate this and the model will be published with the fragment.

Unpublishing a Content Fragment Model

Content fragment models can be unpublished if they are not referenced by any fragments.

To unpublish a content fragment model:

  1. Navigate to Tools, Assets, then open Content Fragment Models.

  2. Navigate to the folder holding your content fragment model.

  3. Select your model, followed by Unpublish from the toolbar.
    The published status will be indicated in the console.

On this page