How would I pull in the first Matrix block including certain blocks only I have a Matrix field setup. I want to be able to pull in the first Matrix block used to print a snippet, but only out of the blocks 'text' or 'textImage'. So the first one used, out of those two only.

This is what I have but it's pulling in the textContent block regardless, even if the text block is first.

    {% set textBlock = entry.body.type('text').first() %}
    {% set textBlock2 = entry.body.type('textImage').first() %}


    {% if textBlock %}
        &lt;p&gt;{{ textBlock.textContent|hacksaw(chars='100', append='...') }}&lt;/p&gt;

        {% else %}

        {% if textBlock2 %}

        &lt;p&gt;{{ textBlock2.text|hacksaw(chars='100', append='...') }}&lt;/p&gt;
        {% endif %}

    {% endif %}
Give this ago.

It will grab the first block that is either "Text" or "Text Image" and then you can use a switch statement to output your template depending on the block type.

{% set firstTextBlock = entry.body.type(['text', 'textImage']).first() %}

{% switch firstTextBlock.type %}

    {% case 'text' %}
        &lt;p&gt;{{ firstTextBlock.textContent|hacksaw(chars='100', append='...') }}&lt;/p&gt;

    {% case 'textImage' %}
        &lt;p&gt;{{ firstTextBlock.text|hacksaw(chars='100', append='...') }}&lt;/p&gt;

{% endswitch %}