<p>You could do: </p>

<pre><code>{% set blocks = post.buildStory.type('textEditorBlock').limit(1) %}
</code></pre>

<p>Also, not your question, but this hacksaw port is great for those teasers.  Has some extra logic to make those a bit cleaner.  Check it out.</p>

<p><a href="https://github.com/ehousestudio/craft_hacksaw" rel="nofollow noreferrer">https://github.com/ehousestudio/craft_hacksaw</a></p>

CC BY-SA 3.0
2017-11-08T16:55:00.117Z
2017-11-08T16:55:00.117Z
sgtpenguin
<p>You could try something like this:</p>

<pre><code>{% set block = post.buildStory.type('textEditorBlock').first() %}
    {{block.textEditor}}
</code></pre>

CC BY-SA 3.0
2017-11-08T17:11:58.567Z
That's it! Solution:

`{% set blocks = entry.buildStory.type('textEditorBlock').one() %}
{% set paragraphs = blocks.textEditor %}
{% set teaser = paragraphs | length > 75 ? paragraphs | slice(0, 250) ~ '...' :  paragraphs %}
<p>{{  teaser  | striptags | raw | typogrify  }}</p>`
TRIM
CC BY-SA 3.0
2017-11-08T17:18:35.973Z
Glad you got it working :)
alexr
CC BY-SA 3.0
2017-11-08T16:50:10.500Z
2017-11-08T16:50:10.500Z
alexr
<p>This is a news feed with a title, image and short blurb beneath. The entry content is built with the Matrix. An entry can be made up of a single 'textEditorBlock' or multiple 'textEditorBlock'. </p>

<p><strong>I just want to return the first 'textEditorBlock' from Matrix.</strong> Currently, all existing 'textEditorBlock' blocks get returned.   </p>

<pre><code>{# Count the number of Matrix Blocks; type: textEditorBlock  #}
{% set blocks = post.buildStory.type('textEditorBlock') %}
{{ blocks | length }}

{% for block in post.buildStory.all() %}
   {# the text #}
   {% set paragraphs = block.textEditor %}
   {% set teaser = paragraphs | length &gt; 75 ? paragraphs | slice(0, 250) ~ '...' :  paragraphs %}
   &lt;p&gt;{{  teaser  | striptags | raw | typogrify  }}&lt;/p&gt;       
{% endfor %} 
</code></pre>

<p>Note: the {{ blocks | length }} tells me the number of 'textEditorBlock' that exist for each entry (1, 4, 4, 2 and 2).</p>

<matrix><filter><blocks>
How to pull the first block of its kind from a Matrix?
# How to pull the first block of its kind from a Matrix?

(Asked by: username_0 on 2017-11-08)

This is a news feed with a title, image and short blurb beneath. The entry content is built with the Matrix. An entry can be made up of a single 'textEditorBlock' or multiple 'textEditorBlock'. 
I just want to return the first 'textEditorBlock' from Matrix. Currently, all existing 'textEditorBlock' blocks get returned.   
{# Count the number of Matrix Blocks; type: textEditorBlock  #}
{% set blocks = post.buildStory.type('textEditorBlock') %}
{{ blocks | length }}

{% for block in post.buildStory.all() %}
   {# the text #}
   {% set paragraphs = block.textEditor %}
   {% set teaser = paragraphs | length > 75 ? paragraphs | slice(0, 250) ~ '...' :  paragraphs %}
   {{  teaser  | striptags | raw | typogrify  }}       
{% endfor %} 

Note: the {{ blocks | length }} tells me the number of 'textEditorBlock' that exist for each entry (1, 4, 4, 2 and 2).

**Tags:** matrix, filter, blocks

---

## 2 answers

### Answer by username_2 on 2017-11-08. Score: 6 | Accepted answer

You could try something like this:
{% set block = post.buildStory.type('textEditorBlock').first() %}
    {{block.textEditor}}

> **Comments:**
> **username_0**: That's it! Solution:  `{% set blocks = entry.buildStory.type('textEditorBlock').one() %} {% set paragraphs = blocks.textEditor %} {% set teaser = paragraphs | length > 75 ? paragraphs | slice(0, 250) ~ '...' :  paragraphs %} <p>{{  teaser  | striptags | raw | typogrify  }}</p>`  
> **username_2**: Glad you got it working :)  

---

### Answer by username_1 on 2017-11-08. Score: 1

You could do: 
{% set blocks = post.buildStory.type('textEditorBlock').limit(1) %}

Also, not your question, but this hacksaw port is great for those teasers.  Has some extra logic to make those a bit cleaner.  Check it out.
https://github.com/ehousestudio/craft_hacksaw


---

