If you create specific content inside a container, it will belong to the container itself.
With the Giotto language, however, it is possible to create content outside the container, with the advantage that this content can be reusable.
For example, it is possible to create an object of type Article, which will be saved on the platform's database and can be retrieved in contexts other than those in which it was created.
Declaring a default content type
A content type can be declared within a template or directly in the platform by following the Journey Lab > Template > Content.
It is also possible to configure the scope of applicability of a content type at the Global level, the Journey level, or only for certain journeys.
To declare a default content use the attribute mn:typedef
.
<div mn:typedef mn:name="type1" mn:label="Tipo 1">
<meta mn:param mn:name="param1" mn:type="text">
Questo é un oggetto di tipo 1 con un parametro:[param:param1]
</div>
<div mn:typedef mn:name="type2" mn:label="Tipo 2">
<div mn:editable>Questo é un oggetto di tipo 2</div>
</div>
Using predefined content
To use a typedef in a container, simply indicate the type of content that you can create within the container.
You can do this by using the attribute mn:type
.
<div mn:container mn:repeatable mn:type="type1"></div>
Remember that more than one type can be declared within a container:
<div mn:container mn:repeatable mn:type="type1,type2"></div>
Default layout
Using the mn:defaul
attribute, it is possible to predefine a layout that will set the order in which the objects are created when the communication is created.
<div mn:container mn:repeatable mn:type="type1,type2" mn:default="type2,type1,type2"></div>