Template Tags

At the most basic level, templating with Bloqs is nothing more than the standard EE tag pair/tag process. But tag pairs in Bloqs go a bit deeper than what you might normally expect to encounter in ExpressionEngine. Let's take a look at an example so you can see how the logic plays out.

Lets say we have a single bloq type defined with 2 atoms:

  • Bloq Name: Content Bloq

  • Bloq Short Name: {content_bloq}

  • Bloq Atom Definitions:

    • Atom Name: Heading

    • Atom Short Name: {heading}

    • Atom Name: Body Content

    • Atom Short Name: {body_content}

And this bloq type is added to a Bloqs custom field assigned to the Pages channel.

  • Field Type: Bloqs

  • Field Name: My Bloq Field

  • Field Short Name: {my_bloq_field}

    • Selected Bloq Types: Content Bloq

Given our base definitions, to output the content in a Pages Channel Entry, your template code would look similar to the following:

{exp:channel:entries channel="page"}

At the bottom of a Bloqs custom field settings page will be a live basic example template based on the bloqs you've created for your project you can use to get started, which may look similar to this:

Once you've created your basic field tag pairs, you may need to use Context Variables to assist in the rendering of the output. Read more about Context Variables next.

If you are using the bloq nesting feature, then more template examples are available.