Show Menu
TOPICS×

Content Fragment Templates

Content fragment models are now recommended for creating all your fragments.
Content fragment models are used for all examples in We.Retail.
Templates are selected when creating a content fragment. They provide the new fragment with the basic structure, element(s) and variation. The templates used for content fragments are subject to the Granite Configuration Manager.
The out-of-the-box templates are held under:
  • /libs/settings/dam/cfm/templates
You can create your site-specific templates for content fragments under:
  • /apps/settings/dam/cfm/templates The location for overlaying out-of-the-box templates or providing customer-specific, application-wide templates that are not intended to be extended/changed at runtime.
  • /conf/global/settings/dam/cfm/templates The location for instance-wide customer-specific templates that need to be changed at runtime.
The order of precedence is (in descending order) /conf , /apps , /libs .
You must not change anything in the /libs path.
This is because the content of /libs is overwritten the next time you upgrade your instance (and may well be overwritten when you apply either a hotfix or feature pack).
The recommended method for configuration and other changes is:
  1. Recreate the required item (i.e. as it exists in /libs ) under /apps
  2. Make any changes within /apps
The basic structure of a template is held under:
conf
  global
    settings
      dam
        cfm
          templates
            <template-name>
              ...

With the specific structure being:
+ <template-name>
    - jcr:primaryType
    - jcr:title
    - jcr:description
    - initialAssociatedContent
    - precreateElements
    - version
    + elements
        - jcr:primaryType
        + <element-name>
            - jcr:primaryType
            - jcr:title
            - defaultContent
            - initialContentType
            - name
        ... + other element definitions
    + variations
        - jcr:primaryType
        + <variation-name>
            - jcr:primaryType
            - jcr:title
            - jcr:description
            - name
        ... + other variation definitions

More details about the nodes and their properties are:
  • Template
    Name Type Value
    < template-name > nt:unstructured This node is the root for each template. It is mandatory and should have a unique name.
    jcr:title
    String
    required
    The title of the template (displayed in the Create Fragment wizard).
    jcr:description
    String
    optional
    A text that describes the purpose of the template (displayed in the Create Fragment wizard).
    initialAssociatedContent
    String[]
    optional
    An array with paths to collections that should be associated to a newly created content fragment by default.
    precreateElements
    Boolean
    required
    true , if the subassets representing the elements (except the master element) of the content fragment should be created when the content fragment is created; false if they should be created "on the fly".
    Note : currently this parameter has to be set to true .
    version
    Long
    required
    Version of the content structure; currently supported:
    Note : currently this parameter has to be set to 2 .
  • Elements
    Name Type Value
    elements
    nt:unstructured
    required
    Node that contains the definition of the elements of the content fragment. It is mandatory and needs to contain at least one child node for the Main element, but can contain [1..n] child nodes.
    When the template is used the elements sub-branch is copied to the model sub-branch of the fragment.
    The first element (as viewed in CRXDE Lite) is automatically considered to be the main element; the node name is irrelevant and the node itself does not have a special significance, apart from the fact that it is represented by the main asset; the other elements are handled as sub assets.
  • Element Name
    Name Type Value
    < element-name > nt:unstructured This node defines an element. It is mandatory and should have a unique name.
    jcr:title
    String
    required
    The title of the element (displayed in the fragment editor's element selector).
    defaultContent
    String
    optional
    default: ""
    Initial content of the element; only used if precreateElements = true
    initialContentType
    String
    optional
    default: text/html
    Initial content type of the element; only used if precreateElements = true ; currently supported:
    • text/html
    • text/plain
    • text/x-markdown
    name
    String
    required
    The internal name of the element; must be unique for the fragment type.
  • Variations
    Name Type Value
    variations
    nt:unstructured
    optional
    This optional node contains the definition of the initial variations of the content fragment.
  • Variation Name
    Name Type Value
    < variation-name >
    nt:unstructured
    required if a variation node is present
    Defines an initial variation. The variation is added to all elements of the content fragment by default.
    The variation will have the same initial content as the respective element (see defaultContent/ initialContentType )
    jcr:title
    String
    required
    The title of the variation (displayed in the fragment editor's Variation tab (left rail)).
    jcr:desciption
    String
    optional
    default: ""
    A text that provides a description of the variation (displayed in the fragment editor's Variation tab (left rail)).