content-type

Defines a CUE content type. A content type defines a particular type of content item. It defines:

  • The fields a content item is composed of.

  • The relation-types a content item may have.

  • How the content item is presented in Content Studio.

The fields in the content type are defined indirectly: a content-type element contains panel elements, which in turn contain field elements. This allows the fields to be grouped together in panels, which correspond to tabs in CUE content item editors.

Syntax
<content-type
    name="NCName"
  >
  ANY-FOREIGN-ELEMENT*
  <ref-relation-type-group/>*
  <panel>...</panel>+
  <parameter/>*
  <summary>...</summary>?
  <url>...</url>?
</content-type>
Examples
  • This example defines a simple content type containing only one panel, a summary and a reference to a relation-type-group.

    <content-type name="news">
      <ui:label>Story</ui:label>
      <ui:description>A news story</ui:description>
      <ui:title-field>title</ui:title-field>
      <panel name="main">
        <ui:label>Main Content</ui:label>
        <ui:description>The main content fields</ui:description>
        <ref-field-group name="title"/>
        <ref-field-group name="summary"/>
        <ref-field-group name="body"/>
      </panel>
      <ref-relation-type-group name="attachments"/>
      <summary>
        <ui:label>Content Summary</ui:label>
        <field name="title" type="basic" mime-type="text/plain"/>
        <field name="summary" type="basic" mime-type="text/plain"/>
      </summary>
      <url>{yyyy}/{MM}/{dd}/article{id}.ece/{field.title}</url>
    </content-type>
  • This example defines a content type to be used for images. Note the use of a link field to store the image reference. Note also the use of ui:icon to select an icon for this type of content item in Content Studio.

    <content-type name="image">
      <ui:label>Picture</ui:label>
      <ui:description>An image</ui:description>
      <ui:title-field>name</ui:title-field>
      <ui:icon>image</ui:icon>
      <panel name="main">
        <ui:label>Image content</ui:label>
        <field mime-type="text/plain" type="basic" name="name">
          <ui:label>Name</ui:label>
          <ui:description>The name of the image</ui:description>
          <constraints>
            <required>true</required>
          </constraints>
        </field>
        <field mime-type="text/plain" type="basic" name="description">
          <ui:label>Description</ui:label>
        </field>
        <field mime-type="text/plain" type="basic" name="alttext">
          <ui:label>Alternative text</ui:label>
        </field>
        <field name="binary" type="link">
          <relation>com.escenic.edit-media</relation>
          <constraints>
            <mime-type>image/jpeg</mime-type>
            <mime-type>image/png</mime-type>
          </constraints>
        </field>
      </panel>
      <panel name="crop">
        <ui:label>Cropped Versions</ui:label>
        <field mime-type="application/json" type="basic" name="representations">
          <ui:label>Image Versions</ui:label>
          <rep:representations type="image-versions">
            <rep:representation name="thumbnail">
              <rep:output width="100" height="100"/>
              <rep:crop/>
              <rep:resize/>
            </rep:representation>
            <rep:representation name="narrow">
              <rep:output width="500" height="400"/>
              <rep:crop/>
              <rep:resize/>
            </rep:representation>
            <rep:representation name="wide">
              <rep:output width="1000" height="800"/>
              <rep:crop/>
              <rep:resize/>
            </rep:representation>
          </rep:representations>
        </field>
      </panel>
      <summary>
        <ui:label>Content Summary</ui:label>
        <field name="caption" type="basic" mime-type="text/plain"/>
        <field name="alttext" type="basic" mime-type="text/plain"/>
      </summary>
    </content-type>
Attributes
name="NCName"

The name of the content-type element.