Blocks are added to the schema and looped over inside the section in liquid.
Copy <div class="hero">
<div class="container">
<h1>{{ section.settings.heading }}</h1>
<div data-gb-custom-block data-tag="for">
<a href="{{ block.settings.link_action }}">
{{ block.settings.link_text }}
</a>
</div>
</div>
</div>
Copy
<div data-gb-custom-block data-tag="schema">
{
"name" : "Example Section" ,
"elements" : [
{
"type" : "text" ,
"id" : "heading" ,
"label" : "Heading" ,
"default" : "This is an example heading"
}
] ,
"blocks" : [
{
"type" : "link" ,
"name" : "Link" ,
"elements" : [
{
"type" : "text" ,
"id" : "link_text" ,
"label" : "Link Text" ,
"default" : "CALL TO ACTION"
} ,
{
"type" : "action" ,
"id" : "link_action" ,
"label" : "Link Action" ,
"default" : "http://www.kajabi.com"
}
]
}
]
}
</div>
To build even more complex sections, a section can have multiple types of blocks that a user chooses from.
Copy <div class="hero">
<div class="container">
<h1>{{ section.settings.heading }}</h1>
<div data-gb-custom-block data-tag="for">
<div data-gb-custom-block data-tag="case">
<div data-gb-custom-block data-tag="when" data-0='link'></div>
<a href="{{ block.settings.link_action }}">
{{ block.settings.link_text }}
</a>
<div data-gb-custom-block data-tag="when" data-0='image'></div>
<img src="{{ block.settings.image }}"/>
</div>
</div>
</div>
</div>
Copy
<div data-gb-custom-block data-tag="schema">
{
"name" : "Example Section" ,
"elements" : [
{
"type" : "text" ,
"id" : "heading" ,
"label" : "Heading" ,
"default" : "This is an example heading"
}
] ,
"blocks" : [
{
"type" : "link" ,
"name" : "Link" ,
"elements" : [
{
"type" : "text" ,
"id" : "link_text" ,
"label" : "Link Text" ,
"default" : "CALL TO ACTION"
} ,
{
"type" : "action" ,
"id" : "link_action" ,
"label" : "Link Action" ,
"default" : "http://www.kajabi.com"
}
]
} ,
{
"type" : "image" ,
"name" : "Image" ,
"elements" : [
{
"type" : "image_picker" ,
"id" : "image" ,
"label" : "Image"
}
]
}
]
}
</div>