Content Fragmentv1

Content Fragment allows a content fragment asset, its elements and variations to be presented on a page.

Using Core Components

Adobe Help Center

Examples

Standard

Content fragment component with an associated content fragment asset. The asset uses the Simple Fragment model and displays some dummy article content, including a header and paragraph. It has one Main element.

Simple Fragment

Main

Lorem Ipsum

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Eu mi bibendum neque egestas congue quisque egestas. Varius morbi enim nunc faucibus a pellentesque. Scelerisque eleifend donec pretium vulputate sapien nec sagittis.

  1. jcr:primaryType: nt:unstructured
  2. jcr:createdBy: admin
  3. paragraphScope: all
  4. jcr:lastModifiedBy: admin
  5. jcr:created:
  6. text: Main Lorem Ipsum Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Eu mi bibendum neque egestas congue quisque egestas. Varius morbi enim nunc faucibus a pellentesque. Scelerisque eleifend donec pretium vulputate sapien nec sagittis.
  7. variationName: master
  8. jcr:lastModified:
  9. sling:resourceType: core/wcm/components/contentfragment/v1/contentfragment
  10. displayMode: multi
  11. fragmentPath: /content/dam/core-components-examples/library/sample-assets/simple-fragment
    
        

    

    
    

Simple Fragment

Main

Lorem Ipsum

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Eu mi bibendum neque egestas congue quisque egestas. Varius morbi enim nunc faucibus a pellentesque. Scelerisque eleifend donec pretium vulputate sapien nec sagittis.

Variations

It is possible to output alternative variations on the page. Here we use the same simple content fragment asset, but instead display its Short variation. Short variations are more suited to mobile apps, for example.

Simple Fragment

Main

Lorem Ipsum

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

  1. jcr:primaryType: nt:unstructured
  2. jcr:createdBy: admin
  3. paragraphScope: all
  4. jcr:lastModifiedBy: admin
  5. jcr:created:
  6. text: Main Lorem Ipsum Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
  7. variationName: short
  8. jcr:lastModified:
  9. sling:resourceType: core/wcm/components/contentfragment/v1/contentfragment
  10. displayMode: multi
  11. fragmentPath: /content/dam/core-components-examples/library/sample-assets/simple-fragment
    
        

    

    
    

Simple Fragment

Main

Lorem Ipsum

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

Structured Content Fragment

In this example, the asset is based on a bespoke Office  model which allows the output of structured data associated with a business location or office.

Adobe Headquarters

Title
Adobe Headquarters
Street Address
345 Park Avenue
City
San Jose
Postal Code
95110-2704
Country
USA
Region
core-components-examples:region/north-america
  1. jcr:primaryType: nt:unstructured
  2. jcr:createdBy: admin
  3. paragraphScope: all
  4. jcr:lastModifiedBy: admin
  5. jcr:created:
  6. variationName: master
  7. jcr:lastModified:
  8. sling:resourceType: core/wcm/components/contentfragment/v1/contentfragment
  9. displayMode: multi
  10. fragmentPath: /content/dam/core-components-examples/library/sample-assets/adobe-headquarters
    
        

    

    
    

Adobe Headquarters

Title
Adobe Headquarters
Street Address
345 Park Avenue
City
San Jose
Postal Code
95110-2704
Country
USA
Region
core-components-examples:region/north-america

Elements

For structured content fragments, it is possible to limit the output to certain elements in the data. In this example we again show the same office, but only its title and city.

Adobe Headquarters

Title
Adobe Headquarters
City
San Jose
  1. jcr:primaryType: nt:unstructured
  2. jcr:createdBy: admin
  3. paragraphScope: all
  4. jcr:lastModifiedBy: admin
  5. elementNames: title,city
  6. jcr:created:
  7. variationName: master
  8. jcr:lastModified:
  9. sling:resourceType: core/wcm/components/contentfragment/v1/contentfragment
  10. displayMode: multi
  11. fragmentPath: /content/dam/core-components-examples/library/sample-assets/adobe-headquarters
    
        

    

    
    

Adobe Headquarters

Title
Adobe Headquarters
City
San Jose