Authoring Content Fragments authoring-content-fragments

Content Fragments are a content abstraction in AEM that allows text-based content to be authored and managed independently of the channels it supports.

AEM Content Fragments are text-based editorial content that may include some structured data elements associated but considered pure content without design or layout information. Content Fragments are typically created as channel-agnostic content, that is intended to be used and re-used across channels, which in turn wrap the content in a context-specific experience.

This video series covers the authoring life-cycle of Content Fragments in AEM. Details about delivering Content Fragments can be found here.

  1. Enabling and defining Content Fragment Models
  2. Authoring Content Fragments
  3. Downloading Content Fragments
  4. Editorial capabilities

Defining Content Fragment Models defining-content-fragment-models

Let’s take a look at content fragments in AEM. Content fragments are - channel agnostic data, that represents some - logical content construct. For example, an article - comprised of a title, article, text, author, and pull quote, or store location comprised - of an address, phone number and hours of operation. Or even something as simple - as a disclaimer or warranty. Let’s get started by looking - at content fragment models, or the data definition - of a content fragment. Content fragment models are made available per AEM configuration, allowing - their use to be controlled by the AEM assets folder hierarchy. We need to make sure that - the content fragment models are enabled, note that - content fragment models can be enabled globally, but this means any content fragments derived from this content fragment model, will be available for creation - anywhere in AEM assets. Once enabled, we can create - content fragment models for this configuration by going to tools, assets, content fragment models. Here, we have a list of - all the configurations in AEM that have content - fragment models enabled. Let’s create a new content fragment model. This model will define the - data schema for contributors who author magazine articles - that appear on the WKND site. In the content fragment model editor, we define the data collection form that doubles as the data model for all content fragments - derived from this model. Over here on the right, we - have a variety of data type options that can be used to define our content fragment model’s elements. Let’s add a single text element for contributor’s full - name, and make it required. We must provide a property type in which this data will be stored. We’ll add a multi-line - text that we can use for the contributors long form biography.
And a content reference for their picture.
This can be used to point to other content in AEM such as image assets, and we can do things like limited. So authors can only select - assets from content in WKND.
Let’s add an occupation drop down where we can predefine a list of options.
So we’ve done two things - simultaneously here. One, we’ve defined the data - model for our contributors. And two, we’ve defined - the data collection form authors will use to create - content representations of our contributors.
Note that the models can be changed after they’ve been used to - create content fragments. However, this current - state of the model applies to all content fragments - derived from the model. Meaning if a new element is added to the content fragment model, and content fragments created - before the new element was added, will have this element, but it will be blank until - an author publishes it. - -

AEM Content Fragments Models, the data schemas of Content Fragments, must be enabled via AEM’s Configuration Browser, which allows Content Fragment Models to be defined on a per configuration basis.

Creating Content Fragments creating-content-fragments

Now that we have our - Content Fragment Model let’s create a content fragment from it. We’ll head over to assets, files and double-check that our assets folder is assigned to the weekend configuration. This will allow us to create our contributor content fragment, and we can see here that - it’s already properly mapped. Let’s create a new content fragment. For this, we’ll navigate - into the assets folder that will house our new content fragment. Note that I’ll be creating - these content fragments beneath an English locale - folder whose known name is EN. This will be important later on when we take a look at summarization.
We can create a new contact, pick the contributor fragment model, and now we can fill out - the data collection form.
The multi-line text element - is of particular interest. When opening this element - in full screen mode we get extra formatting - and editing controls including text format, text statistics, import content from - file and summarize text. Assuming that our content - fragment is located in the supported locale folder. And remember we put ours in English which is why we see this option.
When the multi-line text - element is in full screen mode with a content type of rich text there are extra editor options running across the top of the editor. We can also add image - assets directly in line when using the rich text format. Let’s return to the content fragment and finished populating it.
Our master variant that represents this - contributor is complete. Let’s explore how we can make - another variant or rendition of this content fragment. We’ll create a new variant and the intent of this variant - will be to convey information about the contributor in a concise quickly consumable manner.
Some example uses of this variant may include highlighting this - contributor on the homepage or displaying contributor - information on digital signage via AEM Screens in a brick - and mortar retail location. In both of these cases the real estate to display this content as well as the viewers - attention is limited. So we want to optimize the - content for these situations. New variants will copy - their initial content from the active variant. In our new variant, let’s open the biography - element in full screen mode and reduce the amount of text. Since our content fragment is under an English locale folder, we can use AEM’s content intelligence to suggest a summarization of the text. We’ll specify the number of words we would like to end up with and AEM provides a suggestion. We can adjust the summarization - suggestions as needed by clicking on the - sentences to add or remove. And we’ll accept when we’re satisfied.
Content fragments allow us to associate asset collections with them. This allows us to collect - assets from all over the dam and relate them to our content fragment. We’ll explore the value - of associated content when we use them on an AEM sites page.
Last up is the content fragments metadata. The content fragments are assets in AEM. So they too can have metadata - and custom metadata schemas that collect data about - the content fragment. It’s important not to confuse the metadata of the content fragment with the content of the content fragment as these are two very different things. Let’s quickly create one - more content fragment and I’ll highlight a few other features. The first thing we’ll take a look at is the multi-line text - element import feature which allows us to upload - the element`s content directly from a file on our computer.
Let’s create a summary variant but instead of using summarize we’ll take a look at how diff sync works. Diff sync uses content intelligence to compare the contents of - the element on the variant with the same element on the master and highlight the differences. Let’s make a change in the master and see how we can get those changes into our summary variant. We’ll head back into master, make a change to the biography, returned to summary and - diff sync the element. Diff sync shows us the - master element’s content in the current variant and any additions or - removals that will take place if we perform the sync. As you can see, AEM has - intelligently reconciled the changes and tells us what will - be added or removed. Let’s complete the sync to - update these upstream changes from the master. -

AEM configurations are applied to AEM Assets folder hierarchies to allow their Content Fragment Models to be created as Content Fragments. Content Fragments support a rich form-based authoring experience allowing content to be modeled as a collection of elements.

Content Fragments can have multiple variants, each variant addressing a different use-case (thought, not necessarily channel) for the content.

Example athlete biography for import:

Downloading Content Fragments downloading-content-fragments

Now that we have a few Content Fragments made, let’s take a look at how we can use them. Keep in mind that Content Fragments are meant to be channeling agnostic and are typically not - accessed directly in the DAM for their content. We have a few approaches for - exposing content fragments downloading them directly - from the DAM as a zip, using them on AEM sites as web content or exposing their content as JSON for use by any consuming - application or system. Since we’re already in AEM Assets, let’s take a look at - downloading Content Fragments. To do this, we simply navigate - to our Content Fragments in AEM Assets, select one or more and click download. We have options for what we - can include in the download, including elements, variance and metadata.
Upon opening the zip, we can see we have all - Content Fragment content that we selected for download. -

AEM Content Fragments can be downloaded from AEM Author as a Zip file containing Variants, Elements, and Metadata.

Example Content Fragment download Zip file:

Content Fragment editorial capabilities editorial-capabilities

Content fragments also support some editorial features. We can find these by clicking - into a content fragment, selecting a multi text field - and entering full-screen mode. Here, there’s an annotation - button in the top bar that allows us to annotate and communicate with other authors regarding - this content fragment.
Existing annotations can - be reviewed by opening up the left sidebar and clicking - the annotations icon. This will show any annotations applied to the current text field. The annotated text, which is indicated via highlight can be clicked - on to review, to edit or to delete the annotation.
As a content author in AM, we can then act upon the annotations and modify content in the - content fragment accordingly. We can also compare versions - of the content fragment. This can be done by selecting - the content fragment, opening up the timeline, and selecting a previous - version to compare it to. As we can see with our version comparison, the current version on the left indicated with the current badge - shows us any changes that have been made from this - earlier version on the right. Scrolling down, we can see - that there are comparisons for all of the other fields - as well as comparisons for other variants. - -
Annotation and version compare for Content Fragments were introduced in AEM 6.4 Service Pack 2 and AEM 6.3 Service Pack 3.

Next Steps

Learn about delivering Content Fragments.

Additional Resources additional-resources

To download and install the package below on an AEM 6.4+ instance for the final state from the video series: