Part 2 of the AEM Content Services tutorial covers enabling and defining Content Fragment Models used to define a normalized data structure and authoring interface for creating FAQs.

Tutorial table of contents

Enable Content Fragment Models for We.Retail

Content Fragment Models must be enabled via AEM's Configuration Browser.

If Content Fragment Models are not enabled for a configuration, the Create > Content Fragment button will not appear for the relevant AEM configuration.

Note:

AEM's configurations represent a set of context-aware tenant configurations stored under /conf. Typically AEM configurations correlate with a particular Web site managed in AEM Sites or a business unit responsible for a sub-set of content (Assets, Pages, etc.) in AEM.

In order for a configuration to affect a content hierarchy, the configuration must be referenced via the cq:conf property on that content hierarchy. (This is achieved for the We.Retail configuration in Step 5 below).

Wehn the global configuration is used, the configuration applies to all content, and cq:conf does not need to be set.

part2-enable-cf-models
  1. Log in to AEM Author as a user with appropriate permissions to modify the relevant Configuration.

    For this tutorial, the admin user can be used.

  2. Navigate to Tool > General > Configuration Browser.

  3. Tap the folder icon next to We.Retail to select, and then tap the Edit button in the top left.

  4. Select Content Fragment Models, and tap Save & Close in the top right.

    This enables of Content Fragment Models on Asset Folder content trees that have the We.Retail configuration applied.

    Note:

    This configuration change is not reversible from the AEM Configuration Web UI. To undo this configuration:

    1. Open CRXDE Lite
    2. Navigate to /conf/we-retail/settings/dam/cfm
    3. Delete the models node

    Any exising Content Fragment Models created under this configuration will be deleted as well as their defintions are stored under /conf/we-retail/settings/dam/cfm/models.

  5. Apply the We.Retail configuration to the We.Retail Assets Folder to allow Content Fragments from Content Fragment Models to be created within that hierarchy:

    1. Navigate to AEM > Assets > Files
    2. Select the We.Retail folder
    3. Tap the Properties button in the top action bar to open Folder Properties
    4. In Folder Properties, tap the Cloud Services tab
    5. Verify the Cloud Configuration field is set to /conf/we-retail
    6. Tap Save & Close in the upper-right to persist changes

    Note:

    In earlier AEM 6.3 versions, this value had to be set via CRXDE Lite or via package deployment on the Asset folder's jcr:content node's cq:conf property.

Creating the FAQ Content Fragment Model

part_2_-_creatingthefaqcontentfragmentmodel
  1. Navigate to Tools > Assets > Content Fragment Models.

  2. Tap the We.Retail folder to open.

  3. Tap Create to open the Content Fragment Model creation wizard.

  4. Enter FAQ as the Model Title (description is optional) and tap Create to save.

Defining the structure of the FAQ Content Fragment Model

part_2_-_definingthestructureofthefaqcontentfragmentmodel
  1. Navigate to Tools > Assets > Content Fragment Models > We.Retail.

  2. Select the FAQ Content Fragment Model and tap Edit in the top action bar.

  3. From the Data Types tab on the right, drag the Single line text input into the left drop-zone to define the Question field.

  4. Ensure the new Single line text widget is selected on the left, and the Properties tab is selected on the right. Populate the Properties fields as follows:

    • Render As: textfield
    • Field Label: Question
    • Property Name: question
    • Placeholder: Enter the FAQ question
    • Required: Checked
  5. From the Data Types tab on the right, drag the Multi line text input into the left drop-zone to define the Answer field.

  6. Ensure the new Multi line text input is selected on the left, and the Properties tab is selected on the right. Populate the Properties fields as follows:

    • Field Label: Answer
    • Property Name: answer
    • Description: Enter the FAQ answer

Note:

The Property Name denotes the JCR property name where this value will be stored. This should be a semantic name that is will not change over the life of the Content Fragment Model.

Next step

Optionally, install the aem-content-service-tutorial.part2 solution package via AEM's Package Manager. This package contains the configurations and content outlined in this part of the tutorials

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy