I'd like to output the Names of Matrix Blocks. I know you can filter by block types e.g.
{% for block in entry.myMatrixField.type('text, heading') %}
{% if block.type == "heading" %}
<h3>{{ block.heading }}</h3>
{% else %}
{{ block.text | markdown }}
{% endif %}
{% endfor %}
I know I could use {{ block.type }} and get the block type's handle but, I want to included the actual Name of the block type itself too.
For example, something like this:
{{ block.type.name }}
Is this currently possible?
{% if block.type in ['video', 'image', 'gallery'] %}…does not seem to work, as per this example.
Is there another way? Using
– ianp Apr 28 '17 at 12:05inis very tidy!.nameafterblock.type– Brandon Kelly Apr 29 '17 at 16:18Just to be clear,
– ianp Apr 30 '17 at 17:00( block.type == 'video' or block.type == 'image' or block.type == 'gallery' )does still work, however..handle– Brandon Kelly Apr 30 '17 at 17:16