An Experience Fragment is a group of one or more components including content and layout that can be referenced within pages.
An Experience Fragment Master and/or Variant uses:
- sling:resourceType : /libs/cq/experience-fragments/components/xfpage
As there is no /libs/cq/experience-fragments/components/xfpage/xfpage.html it reverts to
- sling:resourceSuperType : wcm/foundation/components/page
The Plain HTML Rendition
Using the .plain. selector in the URL, you can access the plain HTML rendition.
This is available from the browser, but its primary purpose is to allow other applications (for example, third party web apps, custom mobile implementations) to access the content of the Experience Fragment directly, using only the URL.
The plain HTML rendition adds the protocol, host and context path to paths that are:
- of the type: src , href , or action
- or end with: -src , or -href
Links always reference the publish instance. They are intended to be consumed by third parties, so the link will always be called from the publish instance, not the author.
The plain rendition selector uses a transformer as opposed to additional scripts; the Sling Rewriter is used as the transformer. This is configured at
Templates for Experience Fragments
Only editable templates are supported for Experience Fragments.
When developing a new template for Experience Fragments you can follow follow the standard practices for an editable template.
To create an experience fragment template that is detected by the Create Experience Fragment wizard, you must follow one of these rule sets:
- The resource type of the template (the initial node) must inherit from: cq/experience-fragments/components/xfpage
- And the name of the template must begin with: experience-fragments This allows users to create experience fragments in /content/experience-fragments as the cq:allowedTemplates property of this folder includes all the templates that have names beginning with experience-fragment . Customers can update this property to include their own naming scheme or template locations.
- Allowed templates can be configured in the Experience Fragments console.
Components for Experience Fragments
Developing components for use with/in Experience Fragments follow standard practices.
The only additional configuration is to ensure that the components are allowed on the template, this is achieved with the Content Policy.