Creating Bloqs

When creating a bloq you are required to add at least 1 atom (field) to the bloq. Atom names and short names can be reused. For example every bloq you create could have an atom with the Name of "Heading", and Short Name of "heading". However, you can't repeat short names in the same bloq. This behavior mimics that of a Grid field.

If you give an atom the short name of __hidden then it will not be displayed in the user interface when editing a bloq in an entry. An atom of this name has no other purpose than to fulfill the requirement that every bloq must contain at least 1 atom. Why would you need to do this you might ask? Glad you asked. This can be helpful if you need to create a bloq that has no configuration options or content values, but you might want to render something in a template when that bloq is added to an entry. This can be especially helpful if you're using the nested bloqs and want to give a group of bloqs a parent container to assist with layout rendering. For example:

{bloqs_field}
    {section}
        <h1>{heading}</h1>
        <div>
            {bloqs:children}
        </div>
    {/section}
    
    {container}
        <div>
            {bloqs:children}
        </div>
    {/container}
    
    {content}
        <h2>{heading}<h2>
        {body}
    {/content}
{/bloqs_field}

In that scenario you might have 3 bloqs in your entry nested like this:

section

container

content

content

container

content

Last updated