after searching around for awhile I still cannot find a clear answer to templating Supertables within a matrix field.

I have a field called 'about' which is the matrix field, within that there is a block called 'biography' which holds both a Rich Text Field called 'copy', and a SuperTable field called hgroup, within hgroup there is a plain text field called heading. How do I go about outputting these within the template.

There are other blocks, similar to 'biography', but I'm encountering the same issue with them.

I'm still very new to CraftCMS so some of this has me puzzled.

{% block content %}
  {% for block in entry.about %}
    {% switch entry.about %}
        {% case 'biography' %}
            <div class="contain">
                {% for row in entry.hgroup %}
                    <h3>{{ entry.heading }}</h3>
                {% endfor %}
                  {{ entry.copy }}
    {% endswitch %}
  {% endfor %}
{% endblock %}


2 Answers 2


I think your output is wrong. Looking at your code and explanation, {% for row in entry.hgroup %} should be: {% for row in block.hgroup %}

Same goes for {{ entry.heading }} This should be: {{ row.heading }}

Copy should be: {{ block.copy }}

Working with matrixes and Supertable's is hard in the beginning but you'll get the hang of it.

When you loop over you {{ entry.about }} you loop using a variable named block. that should be used for every field you want to output that's in the matrix field. Same goes for SuperTable's only just one layer deeper.

  • 1
    Thank you! Had to change the switch statement also to '{% switch block.type %}' . I couldnt understand how to use SuperTable but seems so simple now, thanks!
    – Spheriri
    Jan 7, 2017 at 0:32

As an added bonus, this is documented on the Super Table plugin Github page - https://github.com/engram-design/SuperTable#documentation

Specifically the Matrix in Super Table field - https://github.com/engram-design/SuperTable/wiki/Templating-examples#matrix-in-super-table-field - although I'm aware that the question was for a Super Table in Matrix field - its more than enough to get started. Glad you got it solved!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.