Blocks

If you think of a section as a row then its columns are what kajabi calls blocks. Blocks are groupings of settings that can be added and removed from a section by the user.

Blocks are added to the schema and looped over inside the section in liquid.

<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>

<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.

<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>

<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>

Last updated