Handling "Content Body"
What is the content body?
The content body is actually the filling of the Article/Video/Gallery it contains the text, widgets, embeds all of the nitty gritty things that will help with the creation of amazing engaging content.
To further understand how to create a proper body structure you need to follow these steps
How the content body is structured
The different types of content blocks
How the content body is structured
The body of the Article/Video/Gallery consists of an array “blocks“, there are different types of blocks representing different type of data like: paragraphs, lists, tables, widgets, content (articles/videos/galleries/etc.).
A block of data will look like the following:
{
"data": {
"content":<some content>
},
"id": string,
"type": string
}
What the developers should be interested in is the “content“ field. The “content“ field contains the information needed to render the block in whatever way they see fit. All the other information stored in the block is mainly meta-data that is used to optimize the CMS.
Use of the meta-data when developing the client product must be avoided, as it could be changed in the future.
The blocks are not validated, so whatever data is uploaded as a block it will be stored on the server, be careful when uploading data, because if the block is not valid, it will not be visualized by the CMS front-end or it will be displayed as erroneous.
The different types of content blocks
As of this moment the CMS supports 39 different blocks.
They are divided in three categories: Text, Widget and Content
Text blocks
Paragraph
{
"id": "qrMdhd",
"data": {
"type": "paragraph",
"content": "<p>Sample</p>",
"placeholderName": "qrMdhd"
},
"type": "editor_block"
}
Heading
{
"id": "SACxpc",
"data": {
"type": "heading",
"content": "<h2>Sample</h2>",
"placeholderName": "SACxpc"
},
"type": "editor_block"
}
Quote
List
Table
Widget blocks
Odds
Team profile
Team Players
Player profile
Match
Top Scorers
Standings
Player H2H
Team comparison
Match list
Team form
Most decorated players
Player career
Squad statistics
Content blocks
!IMPORTANT
Unlike other content blocks, the main data for the Content blocks are all of the fields except the changeId and preview.
As you may notice they hold and id field which is going to be used to request the article when rendering the content. The reason the id to be the only one provided in the block is that objects like: Article, Video, Gallery, Image, Banner and Poll are complex objects and could contain a lot of data, which will cause huge information to be transferred.
Article
Gallery
The main information that is required for the render on the front-end side is the: id and main_image_id.
The main_image_id is the cover image which was selected for the gallery.
Image
The main information that is required for the render on the front-end side is the id, description.
Video
Embed
The main information that is required for the render on the front-end side is in the content field.
To be able to differentiate between different types of embeds: Video/Social the embed_type is used.
Highlight
The main fields that are required to render Highlight are: title and description
Link
The main fields that are required to render the Link are: link, text, linkType, open_type
Banner
Poll